Share
Embed
Enterprise Integration Patterns with Java EE
Slides for my talk CON7969 at JavaOne 2013. See https://oracleus.activeevents.com/2013/connect/sessionDetail.ww?SESSION_ID=7969
Alexander Heusingfeld
September 23, 2013
Transcript
75 slides
-
We take care of it - personally! © 2013 innoQ
Deutschland GmbH Enterprise Integration Patterns Enterprise Application Integration with Java EE Alexander Heusingfeld, @goldstift, #j1eai -
© 2013 innoQ Deutschland GmbH EAI Pattern in 2013? Nobody
does that anymore! -
© 2013 innoQ Deutschland GmbH When applications communicate Integration is
everywhere CRM Application -
© 2013 innoQ Deutschland GmbH When applications communicate Integration is
everywhere CRM Application ERP Application -
© 2013 innoQ Deutschland GmbH When applications communicate Integration is
everywhere CRM Application ? -
© 2013 innoQ Deutschland GmbH When applications communicate Integration is
everywhere CRM Application -
© 2013 innoQ Deutschland GmbH Enterprise Integration Pattern Remedy for
integration pain! -
© 2013 innoQ Deutschland GmbH Patterns for EAI Design Patterns
(Gamma et al), 1994 -
© 2013 innoQ Deutschland GmbH Patterns for EAI Design Patterns
(Gamma et al), 1994 Proven solutions for common problems -
© 2013 innoQ Deutschland GmbH Patterns for EAI Design Patterns
(Gamma et al), 1994 Proven solutions for common problems Enterprise Integration Patterns (Hohpe & Woolf), 2003 -
© 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 -
© 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 -
© 2013 innoQ Deutschland GmbH “We all believe that asynchronous
messaging carries the greatest promise.” - Martin Fowler (Enterprise Integration Patterns, 2003) -
© 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled
integrated platforms/ languages -
© 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled
integrated platforms/ languages reliable communication -
© 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled
integrated platforms/ languages reliable communication disconnected -
© 2013 innoQ Deutschland GmbH Benefits of async. Messaging decoupled
integrated platforms/ languages reliable communication disconnected throttled -
We take care of it - personally! © 2013 innoQ
Deutschland GmbH But why those Patterns? -
© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not
invented, but observed -
© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not
invented, but observed don’t solve everything -
© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not
invented, but observed don’t solve everything provide ideas -
© 2013 innoQ Deutschland GmbH Thoughts on EAI patterns not
invented, but observed don’t solve everything provide ideas good ones evolve -
© 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 -
© 2013 innoQ Deutschland GmbH Simple order management system (CRUD)
Real Life Scenario order management system -
© 2013 innoQ Deutschland GmbH Simple order management system (CRUD)
Real Life Scenario order management system • basic Java EE -
© 2013 innoQ Deutschland GmbH Simple order management system (CRUD)
Real Life Scenario order management system • basic Java EE • Just CRUD operations -
© 2013 innoQ Deutschland GmbH Simple order management system (CRUD)
Real Life Scenario order management system • basic Java EE • Just CRUD operations • “information silo” -
© 2013 innoQ Deutschland GmbH Simple order management system (CRUD)
Real Life Scenario order management system • basic Java EE • Just CRUD operations • “information silo” -
© 2013 innoQ Deutschland GmbH Enhance the system with an
importer! Simple Change order management system -
© 2013 innoQ Deutschland GmbH Enhance the system with an
importer! Simple Change • Receive CSV-data via HTTP POST order management system -
© 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 -
© 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 -
© 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); } } } -
© 2013 innoQ Deutschland GmbH Enhanced the system with an
importer! System Simple Change done order management system HTTP csv Transform Business Partner -
© 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 -
© 2013 innoQ Deutschland GmbH Recognize an integration task when
it‘s staring in your face? -
© 2013 innoQ Deutschland GmbH Build an easy and maintainable
solution for multiple integration challenges? -
© 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); } } } -
© 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? -
© 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? -
© 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? -
© 2013 innoQ Deutschland GmbH Pipes and Filters divide your
task into small steps http://www.enterpriseintegrationpatterns.com/PipesAndFilters.html -
© 2013 innoQ Deutschland GmbH Route Pipe Apply pipes &
filters pattern Pipe outbound transform inbound -
© 2013 innoQ Deutschland GmbH Route Pipe Apply pipes &
filters pattern Pipe outbound transform inbound Servlet -
© 2013 innoQ Deutschland GmbH Route Pipe Apply pipes &
filters pattern Pipe outbound transform inbound Servlet Custom -
© 2013 innoQ Deutschland GmbH Route Pipe Apply pipes &
filters pattern Pipe outbound transform inbound Servlet Custom JPA -
© 2013 innoQ Deutschland GmbH When you got the right
tools to do the job? -
© 2013 innoQ Deutschland GmbH ADAPTERS? http://www.flickr.com/photos/mroach/3922903520/ Property of ChinBuye
Limited. http://bit.ly/xBKwGw -
© 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"); -
© 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"/> -
© 2013 innoQ Deutschland GmbH Should I always use an
EAI-Framework? -
© 2013 innoQ Deutschland GmbH Should I always use an
EAI-Framework? It depends! -
© 2013 innoQ Deutschland GmbH Further tips considering EAI small
building blocks -
© 2013 innoQ Deutschland GmbH Further tips considering EAI small
building blocks no shared mutable state -
© 2013 innoQ Deutschland GmbH Further tips considering EAI small
building blocks no shared mutable state use immutable DTOs -
© 2013 innoQ Deutschland GmbH Further tips considering EAI small
building blocks no shared mutable state use immutable DTOs => increased scalability -
© 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” -
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