$30 off During Our Annual Pro Sale. View Details »

Enterprise Integration Patterns with Java EE

Enterprise Integration Patterns with Java EE

Alexander Heusingfeld

September 23, 2013
Tweet

More Decks by Alexander Heusingfeld

Other Decks in Programming

Transcript

  1. We take care of it - personally! © 2013 innoQ

    Deutschland GmbH Enterprise Integration Patterns Enterprise Application Integration with Java EE Alexander Heusingfeld, @goldstift, #j1eai
  2. © 2013 innoQ Deutschland GmbH

  3. © 2013 innoQ Deutschland GmbH EAI Pattern in 2013?

  4. © 2013 innoQ Deutschland GmbH EAI Pattern in 2013? Nobody

    does that anymore!
  5. © 2013 innoQ Deutschland GmbH When applications communicate Integration is

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

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

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

    everywhere CRM Application
  9. © 2013 innoQ Deutschland GmbH Enterprise Integration Pattern

  10. © 2013 innoQ Deutschland GmbH Enterprise Integration Pattern Remedy for

    integration pain!
  11. © 2013 innoQ Deutschland GmbH Patterns for EAI

  12. © 2013 innoQ Deutschland GmbH Patterns for EAI Design Patterns

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

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

    (Gamma et al), 1994 Proven solutions for common problems Enterprise Integration Patterns (Hohpe & Woolf), 2003
  15. © 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
  16. © 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
  17. © 2013 innoQ Deutschland GmbH “We all believe that asynchronous

    messaging carries the greatest promise.” - Martin Fowler (Enterprise Integration Patterns, 2003)
  18. © 2013 innoQ Deutschland GmbH MESSAGING? http://bit.ly/PtrhWy

  19. © 2013 innoQ Deutschland GmbH Benefits of async. Messaging

  20. © 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled

  21. © 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled

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

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

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

    integrated platforms/ languages reliable communication disconnected throttled
  25. We take care of it - personally! © 2013 innoQ

    Deutschland GmbH But why those Patterns?
  26. © 2013 innoQ Deutschland GmbH Thoughts on EAI patterns

  27. © 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not

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

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

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

    invented, but observed don’t solve everything provide ideas good ones evolve
  31. © 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
  32. © 2013 innoQ Deutschland GmbH Simple order management system (CRUD)

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

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

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

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

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

  38. © 2013 innoQ Deutschland GmbH Enhance the system with an

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

    importer! Simple Change • Receive CSV-data via HTTP POST order management system
  40. © 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
  41. © 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
  42. © 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<Order> orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } }
  43. © 2013 innoQ Deutschland GmbH Enhanced the system with an

    importer! System Simple Change done order management system HTTP csv Transform Business Partner
  44. © 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
  45. © 2013 innoQ Deutschland GmbH Recognize an integration task when

    it‘s staring in your face?
  46. © 2013 innoQ Deutschland GmbH EASY! http://www.flickr.com/photos/wespionage/184793114

  47. © 2013 innoQ Deutschland GmbH Build an easy and maintainable

    solution for multiple integration challenges?
  48. © 2013 innoQ Deutschland GmbH NO PROBLEM! http://www.flickr.com/photos/mroach/3922903520/

  49. © 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<Order> orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } }
  50. © 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<Order> orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } } testable?
  51. © 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<Order> orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } } testable? reusable?
  52. © 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<Order> orders = parser.transform(data); for (Order order : orders) { bean.persist(order); } } } testable? reusable? extensible?
  53. © 2013 innoQ Deutschland GmbH Pipes and Filters http://www.enterpriseintegrationpatterns.com/PipesAndFilters.html

  54. © 2013 innoQ Deutschland GmbH Pipes and Filters divide your

    task into small steps http://www.enterpriseintegrationpatterns.com/PipesAndFilters.html
  55. © 2013 innoQ Deutschland GmbH Route Pipe Apply pipes &

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

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

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

    filters pattern Pipe outbound transform inbound Servlet Custom JPA
  59. © 2013 innoQ Deutschland GmbH When you got the right

    tools to do the job?
  60. © 2013 innoQ Deutschland GmbH INFALLIBLE! http://www.flickr.com/photos/ohskylab/4547693502

  61. © 2013 innoQ Deutschland GmbH Is there something simpler?

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

    Limited. http://bit.ly/xBKwGw
  63. © 2013 innoQ Deutschland GmbH EAI Frameworks Apache Camel Spring

    Integration
  64. © 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");
  65. © 2013 innoQ Deutschland GmbH Spring Integration sample <int-http:inbound-channel-adapter !

    id="orderImportHttpAdapter" ! path="/order/import” supported-methods="POST" ! channel="ordersIn"/> <int:channel="ordersIn"/> <int:splitter input-channel="ordersIn" ref="orderSplitter" method="split" output-channel="ordersToDB" /> <bean id="orderSplitter" class="com.innoq.samples.eai.OrderSplitter"/> <int:channel="ordersToDB"/> <int-jpa:updating-outbound-gateway request-channel="ordersToDB" entity-class="com.innoq.samples.eai.domain.Order" entity-manager="em"/>
  66. © 2013 innoQ Deutschland GmbH

  67. © 2013 innoQ Deutschland GmbH Should I always use an

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

    EAI-Framework? It depends!
  69. © 2013 innoQ Deutschland GmbH Further tips considering EAI

  70. © 2013 innoQ Deutschland GmbH Further tips considering EAI small

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

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

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

    building blocks no shared mutable state use immutable DTOs => increased scalability
  74. © 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”
  75. We take care of it - personally! © 2013 innoQ

    Deutschland GmbH Thanks for your attention! Alexander Heusingfeld, @goldstift alexander.heusingfeld@innoq.com http://www.innoq.com/de/talks twitter #j1eai - speakerdeck