Slide 1

Slide 1 text

We take care of it - personally! © 2013 innoQ Deutschland GmbH Enterprise Integration Patterns Enterprise Application Integration with Java EE Alexander Heusingfeld, @goldstift, #j1eai

Slide 2

Slide 2 text

© 2013 innoQ Deutschland GmbH

Slide 3

Slide 3 text

© 2013 innoQ Deutschland GmbH EAI Pattern in 2013?

Slide 4

Slide 4 text

© 2013 innoQ Deutschland GmbH EAI Pattern in 2013? Nobody does that anymore!

Slide 5

Slide 5 text

© 2013 innoQ Deutschland GmbH When applications communicate Integration is everywhere CRM Application

Slide 6

Slide 6 text

© 2013 innoQ Deutschland GmbH When applications communicate Integration is everywhere CRM Application ERP Application

Slide 7

Slide 7 text

© 2013 innoQ Deutschland GmbH When applications communicate Integration is everywhere CRM Application ?

Slide 8

Slide 8 text

© 2013 innoQ Deutschland GmbH When applications communicate Integration is everywhere CRM Application

Slide 9

Slide 9 text

© 2013 innoQ Deutschland GmbH Enterprise Integration Pattern

Slide 10

Slide 10 text

© 2013 innoQ Deutschland GmbH Enterprise Integration Pattern Remedy for integration pain!

Slide 11

Slide 11 text

© 2013 innoQ Deutschland GmbH Patterns for EAI

Slide 12

Slide 12 text

© 2013 innoQ Deutschland GmbH Patterns for EAI Design Patterns (Gamma et al), 1994

Slide 13

Slide 13 text

© 2013 innoQ Deutschland GmbH Patterns for EAI Design Patterns (Gamma et al), 1994 Proven solutions for common problems

Slide 14

Slide 14 text

© 2013 innoQ Deutschland GmbH Patterns for EAI Design Patterns (Gamma et al), 1994 Proven solutions for common problems Enterprise Integration Patterns (Hohpe & Woolf), 2003

Slide 15

Slide 15 text

© 2013 innoQ Deutschland GmbH Patterns for EAI Design Patterns (Gamma et al), 1994 Proven solutions for common problems Enterprise Integration Patterns (Hohpe & Woolf), 2003 Swiss-army knife for asynchronous messaging

Slide 16

Slide 16 text

© 2013 innoQ Deutschland GmbH Patterns for EAI Design Patterns (Gamma et al), 1994 Proven solutions for common problems Enterprise Integration Patterns (Hohpe & Woolf), 2003 Swiss-army knife for asynchronous messaging www.eaipatterns.com

Slide 17

Slide 17 text

© 2013 innoQ Deutschland GmbH “We all believe that asynchronous messaging carries the greatest promise.” - Martin Fowler (Enterprise Integration Patterns, 2003)

Slide 18

Slide 18 text

© 2013 innoQ Deutschland GmbH MESSAGING? http://bit.ly/PtrhWy

Slide 19

Slide 19 text

© 2013 innoQ Deutschland GmbH Benefits of async. Messaging

Slide 20

Slide 20 text

© 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled

Slide 21

Slide 21 text

© 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled integrated platforms/ languages

Slide 22

Slide 22 text

© 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled integrated platforms/ languages reliable communication

Slide 23

Slide 23 text

© 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled integrated platforms/ languages reliable communication disconnected

Slide 24

Slide 24 text

© 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled integrated platforms/ languages reliable communication disconnected throttled

Slide 25

Slide 25 text

We take care of it - personally! © 2013 innoQ Deutschland GmbH But why those Patterns?

Slide 26

Slide 26 text

© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns

Slide 27

Slide 27 text

© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not invented, but observed

Slide 28

Slide 28 text

© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not invented, but observed don’t solve everything

Slide 29

Slide 29 text

© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not invented, but observed don’t solve everything provide ideas

Slide 30

Slide 30 text

© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not invented, but observed don’t solve everything provide ideas good ones evolve

Slide 31

Slide 31 text

© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not invented, but observed don’t solve everything provide ideas good ones evolve changes are incorporated at eaipatterns.com

Slide 32

Slide 32 text

© 2013 innoQ Deutschland GmbH Simple order management system (CRUD) Real Life Scenario order management system

Slide 33

Slide 33 text

© 2013 innoQ Deutschland GmbH Simple order management system (CRUD) Real Life Scenario order management system • basic Java EE

Slide 34

Slide 34 text

© 2013 innoQ Deutschland GmbH Simple order management system (CRUD) Real Life Scenario order management system • basic Java EE • Just CRUD operations

Slide 35

Slide 35 text

© 2013 innoQ Deutschland GmbH Simple order management system (CRUD) Real Life Scenario order management system • basic Java EE • Just CRUD operations • “information silo”

Slide 36

Slide 36 text

© 2013 innoQ Deutschland GmbH Simple order management system (CRUD) Real Life Scenario order management system • basic Java EE • Just CRUD operations • “information silo”

Slide 37

Slide 37 text

© 2013 innoQ Deutschland GmbH Simple Change order management system

Slide 38

Slide 38 text

© 2013 innoQ Deutschland GmbH Enhance the system with an importer! Simple Change order management system

Slide 39

Slide 39 text

© 2013 innoQ Deutschland GmbH Enhance the system with an importer! Simple Change • Receive CSV-data via HTTP POST order management system

Slide 40

Slide 40 text

© 2013 innoQ Deutschland GmbH Enhance the system with an importer! Simple Change • Receive CSV-data via HTTP POST • CSV contains header and detail records order management system

Slide 41

Slide 41 text

© 2013 innoQ Deutschland GmbH Enhance the system with an importer! Simple Change • Receive CSV-data via HTTP POST • CSV contains header and detail records • Import data into database order management system

Slide 42

Slide 42 text

© 2013 innoQ Deutschland GmbH A Simple Java EE sample @WebServlet(urlPatterns = {"/order/import"}) public class ImporterServlet extends HttpServlet { @Inject OrderBean bean; @Inject CsvDataParser parser; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("csvdata"); List orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } }

Slide 43

Slide 43 text

© 2013 innoQ Deutschland GmbH Enhanced the system with an importer! System Simple Change done order management system HTTP csv Transform Business Partner

Slide 44

Slide 44 text

© 2013 innoQ Deutschland GmbH Integrate the system of a forwarder System Change happens order management system HTTP csv Transform Business Partner forwarder system FTP SMTP SOAP WSSE REST

Slide 45

Slide 45 text

© 2013 innoQ Deutschland GmbH Recognize an integration task when it‘s staring in your face?

Slide 46

Slide 46 text

© 2013 innoQ Deutschland GmbH EASY! http://www.flickr.com/photos/wespionage/184793114

Slide 47

Slide 47 text

© 2013 innoQ Deutschland GmbH Build an easy and maintainable solution for multiple integration challenges?

Slide 48

Slide 48 text

© 2013 innoQ Deutschland GmbH NO PROBLEM! http://www.flickr.com/photos/mroach/3922903520/

Slide 49

Slide 49 text

© 2013 innoQ Deutschland GmbH Something wrong here? @WebServlet(urlPatterns = {"/order/import"}) public class ImporterServlet extends HttpServlet { @Inject OrderBean bean; @Inject CsvDataParser parser; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("csvdata"); List orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } }

Slide 50

Slide 50 text

© 2013 innoQ Deutschland GmbH Something wrong here? @WebServlet(urlPatterns = {"/order/import"}) public class ImporterServlet extends HttpServlet { @Inject OrderBean bean; @Inject CsvDataParser parser; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("csvdata"); List orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } } testable?

Slide 51

Slide 51 text

© 2013 innoQ Deutschland GmbH Something wrong here? @WebServlet(urlPatterns = {"/order/import"}) public class ImporterServlet extends HttpServlet { @Inject OrderBean bean; @Inject CsvDataParser parser; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("csvdata"); List orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } } testable? reusable?

Slide 52

Slide 52 text

© 2013 innoQ Deutschland GmbH Something wrong here? @WebServlet(urlPatterns = {"/order/import"}) public class ImporterServlet extends HttpServlet { @Inject OrderBean bean; @Inject CsvDataParser parser; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = request.getParameter("csvdata"); List orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } } testable? reusable? extensible?

Slide 53

Slide 53 text

© 2013 innoQ Deutschland GmbH Pipes and Filters http://www.enterpriseintegrationpatterns.com/PipesAndFilters.html

Slide 54

Slide 54 text

© 2013 innoQ Deutschland GmbH Pipes and Filters divide your task into small steps http://www.enterpriseintegrationpatterns.com/PipesAndFilters.html

Slide 55

Slide 55 text

© 2013 innoQ Deutschland GmbH Route Pipe Apply pipes & filters pattern Pipe outbound transform inbound

Slide 56

Slide 56 text

© 2013 innoQ Deutschland GmbH Route Pipe Apply pipes & filters pattern Pipe outbound transform inbound Servlet

Slide 57

Slide 57 text

© 2013 innoQ Deutschland GmbH Route Pipe Apply pipes & filters pattern Pipe outbound transform inbound Servlet Custom

Slide 58

Slide 58 text

© 2013 innoQ Deutschland GmbH Route Pipe Apply pipes & filters pattern Pipe outbound transform inbound Servlet Custom JPA

Slide 59

Slide 59 text

© 2013 innoQ Deutschland GmbH When you got the right tools to do the job?

Slide 60

Slide 60 text

© 2013 innoQ Deutschland GmbH INFALLIBLE! http://www.flickr.com/photos/ohskylab/4547693502

Slide 61

Slide 61 text

© 2013 innoQ Deutschland GmbH Is there something simpler?

Slide 62

Slide 62 text

© 2013 innoQ Deutschland GmbH ADAPTERS? http://www.flickr.com/photos/mroach/3922903520/ Property of ChinBuye Limited. http://bit.ly/xBKwGw

Slide 63

Slide 63 text

© 2013 innoQ Deutschland GmbH EAI Frameworks Apache Camel Spring Integration

Slide 64

Slide 64 text

© 2013 innoQ Deutschland GmbH A simple camel route from("jetty:http://localhost:9080/order/import") .routeId(“orderimport”) .process(new PostParameterProcessor(“csvdata”)) .process(new StringRemover(new String[]{"\""})) .unmarshal().csv() .split(body(List.class)) .aggregate(header("orderId"), new StringAggregationStrategy()).completionTimeout(3000) .to("seda:singlepartsroute");

Slide 65

Slide 65 text

© 2013 innoQ Deutschland GmbH Spring Integration sample

Slide 66

Slide 66 text

© 2013 innoQ Deutschland GmbH

Slide 67

Slide 67 text

© 2013 innoQ Deutschland GmbH Should I always use an EAI-Framework?

Slide 68

Slide 68 text

© 2013 innoQ Deutschland GmbH Should I always use an EAI-Framework? It depends!

Slide 69

Slide 69 text

© 2013 innoQ Deutschland GmbH Further tips considering EAI

Slide 70

Slide 70 text

© 2013 innoQ Deutschland GmbH Further tips considering EAI small building blocks

Slide 71

Slide 71 text

© 2013 innoQ Deutschland GmbH Further tips considering EAI small building blocks no shared mutable state

Slide 72

Slide 72 text

© 2013 innoQ Deutschland GmbH Further tips considering EAI small building blocks no shared mutable state use immutable DTOs

Slide 73

Slide 73 text

© 2013 innoQ Deutschland GmbH Further tips considering EAI small building blocks no shared mutable state use immutable DTOs => increased scalability

Slide 74

Slide 74 text

© 2013 innoQ Deutschland GmbH Further tips considering EAI small building blocks no shared mutable state use immutable DTOs => increased scalability advanced: see “SEDA” & “actor model”

Slide 75

Slide 75 text

We take care of it - personally! © 2013 innoQ Deutschland GmbH Thanks for your attention! Alexander Heusingfeld, @goldstift [email protected] http://www.innoq.com/de/talks twitter #j1eai - speakerdeck