Upgrade to Pro — share decks privately, control downloads, hide ads and more …

EAI War Stories

EAI War Stories

Slides for our talk at #OOP2014

Alexander Heusingfeld

February 04, 2014
Tweet

More Decks by Alexander Heusingfeld

Other Decks in Technology

Transcript

  1. We take care of it - personally!
    © 2014 innoQ Deutschland GmbH
    EAI War Stories
    Praxisbeispiele zu EAI-Pattern und Lessons Learned
    !
    Alexander Heusingfeld, @goldstift
    Martin Huber, @waterback

    View Slide

  2. © 2014 innoQ Deutschland GmbH
    EAI Pattern in 2013?
    Nobody uses them anymore!

    View Slide

  3. © 2014 innoQ Deutschland GmbH
    That’s THE problem!

    View Slide

  4. © 2014 innoQ Deutschland GmbH
    Multitude of potential service consumers
    Integration is ubiquitous
    CRM
    Application

    View Slide

  5. © 2014 innoQ Deutschland GmbH
    Multitude of potential service consumers
    Integration is ubiquitous
    CRM
    Application
    ERP
    Application

    View Slide

  6. © 2014 innoQ Deutschland GmbH
    Multitude of potential service consumers
    Integration is ubiquitous
    CRM
    Application
    ?

    View Slide

  7. © 2014 innoQ Deutschland GmbH
    Multitude of potential service consumers
    Integration is ubiquitous
    CRM
    Application

    View Slide

  8. We take care of it - personally!
    © 2014 innoQ Deutschland GmbH
    Integration Styles

    View Slide

  9. © 2014 innoQ Deutschland GmbH
    File Transfer
    http://www.eaipatterns.com/FileTransferIntegration.

    View Slide

  10. © 2014 innoQ Deutschland GmbH
    Shared Database
    http://www.eaipatterns.com/SharedDataBaseIntegration.

    View Slide

  11. © 2014 innoQ Deutschland GmbH
    Remote Procedure Invocation
    http://www.eaipatterns.com/EncapsulatedSynchronousIntegration.

    View Slide

  12. © 2014 innoQ Deutschland GmbH
    Messaging
    http://www.eaipatterns.com/Messaging.h

    View Slide

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

    View Slide

  14. © 2014 innoQ Deutschland GmbH
    Searching for a book?
    Enterprise Integration Patterns
    (Hohpe & Woolf), 2003
    www.eaipatterns.com
    Swiss-army knife for asynchronous messaging

    View Slide

  15. We take care of it - personally!
    © 2014 innoQ Deutschland GmbH
    Theories in practice

    View Slide

  16. © 2014 innoQ Deutschland GmbH
    Simple order management system (CRUD)
    Real Life Scenario
    order
    management
    system

    View Slide

  17. © 2014 innoQ Deutschland GmbH
    Simple ChangeRequest
    order
    management
    system

    View Slide

  18. © 2014 innoQ Deutschland GmbH
    Simple ChangeRequest
    We need an importer!
    order
    management
    system

    View Slide

  19. © 2013 innoQ Deutschland GmbH
    A Java EE servlet to the rescue
    @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);!
    }!
    }!
    }

    View Slide

  20. © 2014 innoQ Deutschland GmbH
    System
    Simple Change done
    order
    management
    system
    HTTP
    csv
    Transfor
    Business Partner

    View Slide

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

    View Slide

  22. © 2014 innoQ Deutschland GmbH
    What are the lessons learned?

    View Slide

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

    View Slide

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

    View Slide

  25. © 2014 innoQ Deutschland GmbH
    Build an easy and maintainable solution
    for multiple integration challenges?

    View Slide

  26. © 2013 innoQ Deutschland GmbH
    NO PROBLEM!
    http://www.flickr.com/p

    View Slide

  27. © 2014 innoQ Deutschland GmbH
    Any help in the toolbox?

    View Slide

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

    View Slide

  29. © 2013 innoQ Deutschland GmbH
    EAI Frameworks
    Apache Camel Spring Integration

    View Slide

  30. © 2013 innoQ Deutschland GmbH
    Pipes and Filters
    divide your task into small steps

    View Slide

  31. © 2011 innoQ Deutschland GmbH
    Camel-XML with Spring

    ...








    !



    !



    View Slide

  32. © 2011 innoQ Deutschland GmbH
    Camel fluent API in Java
    public class PipelineExample extends RouteBuilder {
    !
    @Override
    public void configure() throws Exception {
    from("file://Users/martinh/temp/sample1")
    .to("bean:orderTransform?method=transformOrder")
    .to("bean:orderCheckBean?method=validateOrder")
    .to("jms:queue:order.process");
    }
    }

    View Slide

  33. © 2011 innoQ Deutschland GmbH
    Pipes & Filters
    public class PipesFiltersExample extends RouteBuilder {
    !
    @Override
    public void configure() throws Exception {
    from("jms:queue:order.in?maxConcurrentConsumers=5")
    .to("bean:decryptBean")
    .to("seda:authenticate");
    !
    from("seda:authenticate")
    .process(new AuthenticationProcessor())
    .to("seda:dedup");
    !
    from("seda:dedup")
    .process(new DeDupProcessor()
    .to("jms:queue:order.processfurther");
    !
    }
    }

    View Slide

  34. © 2011 innoQ Deutschland GmbH
    from("seda:authenticate")!
    .process(new AuthenticationProcessor())!
    .to("seda:dedup");!
    public class AuthenticationProcessor implements Processor {!
    ! @Override!
    ! public void process(Exchange exchange) throws Exception {!
    MyOrder order = (MyOrder)exchange.getIn().getBody();!
    String type = exchange.getIn().getHeader("orderType");!
    ! }!
    }
    Pipes & Filters

    View Slide

  35. © 2014 innoQ Deutschland GmbH
    All you need are the right tools for the job?

    View Slide

  36. © 2013 innoQ Deutschland GmbH
    ALMOST
    http://www.flickr.com/p

    View Slide

  37. © 2014 innoQ Deutschland GmbH
    OracleDB + AQ
    Admin UI
    Real-life scenario: Control Bus
    xml-route-
    EAI-Node
    EAI-Node
    EAI-Node
    ctrl-queue
    Tomcat
    Embedded Jetty

    View Slide

  38. © 2014 innoQ Deutschland GmbH
    OracleDB + AQ
    Real-life scenario: Control Bus
    xml-route-
    EAI-Node
    database connection
    EAI-Node
    EAI-Node
    ctrl-queue
    Initial Node configuration
    node type (command line arg)
    Admin UI

    View Slide

  39. © 2014 innoQ Deutschland GmbH
    OracleDB + AQ
    Real-life scenario: Control Bus
    xml-route-
    EAI-Node
    subscribe to control queue
    EAI-Node
    EAI-Node
    ctrl-queue
    1. Server startup
    Admin UI

    View Slide

  40. © 2014 innoQ Deutschland GmbH
    OracleDB + AQ
    Real-life scenario: Control Bus
    xml-route-
    EAI-Node
    load node-type specific config
    EAI-Node
    EAI-Node
    ctrl-queue
    subscribe to control queue
    1. Server startup
    Admin UI

    View Slide

  41. © 2014 innoQ Deutschland GmbH
    OracleDB + AQ
    Config change @Runtime
    xml-route-
    EAI-Node
    EAI-Node
    EAI-Node
    ctrl-queue
    2. during runtime
    route config is changed
    Admin UI

    View Slide

  42. © 2014 innoQ Deutschland GmbH
    OracleDB + AQ
    Config change @Runtime
    xml-route-
    EAI-Node
    EAI-Node
    EAI-Node
    ctrl-queue
    route config is changed
    publish config update message
    Admin UI
    2. during runtime

    View Slide

  43. © 2014 innoQ Deutschland GmbH
    OracleDB + AQ
    Config change @Runtime
    xml-route-
    EAI-Node
    interpret relevance of control message
    EAI-Node
    EAI-Node
    ctrl-queue
    3. upon control message arrival
    Admin UI

    View Slide

  44. © 2014 innoQ Deutschland GmbH
    OracleDB + AQ
    Config change @Runtime
    xml-route-
    EAI-Node
    affected nodes reload configuration
    EAI-Node
    EAI-Node
    ctrl-queue
    interpret relevance of control message
    Admin UI
    3. upon control message arrival

    View Slide

  45. © 2014 innoQ Deutschland GmbH
    OracleDB + AQ
    Admin UI
    Lessons Learned?
    xml-route-
    EAI-Node
    EAI-Node
    EAI-Node
    ctrl-queue

    View Slide

  46. © 2014 innoQ Deutschland GmbH
    Testbarkeit vs. Konfigurierbarkeit?

    View Slide

  47. © 2014 innoQ Deutschland GmbH
    Testbarkeit und Konfigurierbarkeit

    View Slide

  48. © 2013 innoQ Deutschland GmbH
    Message Ordering

    View Slide

  49. © 2013 innoQ Deutschland GmbH
    Message Ordering

    View Slide

  50. © 2013 innoQ Deutschland GmbH
    from(“ibmmq:QUEUE.IN“).noAutoStartup()
    .transacted()
    .policy(required)
    .routeId(BasicRouteBuilder
    .stdfromRouteId(this.componentBaseName))
    .process(vslHeadersProcessor)
    .setHeader(HDR_DUMMYCOMPLCHK_IBR, constant(PASSEDMSG))
    .bean(inboundTargetDispatcherBean)
    .wireTap("seda:inboundRouter.log");
    Message Ordering

    View Slide

  51. © 2013 innoQ Deutschland GmbH
    Message Ordering

    View Slide

  52. © 2013 innoQ Deutschland GmbH
    Message Ordering

    View Slide

  53. © 2013 innoQ Deutschland GmbH
    SpringTransactionPolicy required = lookup("PROPAGATION_REQUIRED",
    SpringTransactionPolicy.class);
    for (int i = 0; i < NROFROUTES; i++) {
    String iasS = String.valueOf(i);
    from(fromEndpoint.replaceAll("§", iasS)).noAutoStartup()
    .transacted()
    .policy(required)
    .routeId(KONTO_ZP_PREROUTEID + iasS)
    .process(new CheckRedeliveryProcessor())
    .process(new ZahlplanFacetConverter())
    .bean(zpBean, "process")
    .to("bean:kontostatctr?method=stopCounter")
    .wireTap(logEndpoint);
    }
    Message Ordering

    View Slide

  54. © 2014 innoQ Deutschland GmbH
    Does it save money?

    View Slide

  55. © 2014 innoQ Deutschland GmbH
    Does it save money?

    View Slide

  56. © 2014 innoQ Deutschland GmbH
    Backward compatibility via EAI

    View Slide

  57. © 2013 innoQ Deutschland GmbH
    Transformation mit BPMN-System (1)

    View Slide

  58. © 2013 innoQ Deutschland GmbH
    Transformation für BPMN-System (2)

    View Slide

  59. © 2013 innoQ Deutschland GmbH
    Transformation für BPMN-System (2)

    View Slide

  60. © 2013 innoQ Deutschland GmbH
    Transformation für BPMN-System (2)

    View Slide

  61. © 2013 innoQ Deutschland GmbH
    Transformation für BPMN-System (3)

    View Slide

  62. © 2014 innoQ Deutschland GmbH

    View Slide

  63. © 2014 innoQ Deutschland GmbH
    Should I always use an EAI-Framework?

    View Slide

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

    View Slide

  65. © 2014 innoQ Deutschland GmbH
    Scenario: Kilogramm vs. Stück

    View Slide

  66. © 2014 innoQ Deutschland GmbH
    Lagerverwalt-
    ungssystem
    Touren-
    planung
    Ein Integrationsproblem?
    Produktions
    system

    View Slide

  67. © 2014 innoQ Deutschland GmbH
    Lagerverwalt-
    ungssystem
    Touren-
    planung
    Ein Integrationsproblem?
    Produktions
    system
    Kg
    Kg
    Kg Kg Stck

    View Slide

  68. © 2014 innoQ Deutschland GmbH
    Lagerverwalt-
    ungssystem
    Touren-
    planung
    Kein Integrationsproblem
    Produktions
    system
    Kg
    Kg
    Stck Stck Stck

    View Slide

  69. © 2014 innoQ Deutschland GmbH
    Further tips considering EAI

    View Slide

  70. © 2014 innoQ Deutschland GmbH
    Further tips considering EAI
    small building blocks

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  75. We take care of it - personally!
    © 2014 innoQ Deutschland GmbH
    Alexander Heusingfeld, @goldstift
    [email protected]
    Martin Huber, @waterback
    [email protected]
    http://www.innoq.com/de/talks
    Vielen Dank!

    View Slide