Service Oriented Integration with ServiceMix

3,379 views

Published on

Presented to Colorado Springs Open Source Users Group on April 28, 2008 by William Henry.

Published in: Technology

Service Oriented Integration with ServiceMix

  1. 1. Service Oriented Integration With Apache ServiceMix William G Henry william_henry@mac.com Presentation By Bruce Snyder bsnyder@apache.org
  2. 2. Agenda  Enterprise Service Bus  Java Business Integration  Apache ServiceMix ESB  Apache Camel (intro) 2
  3. 3. What is an ESB? 3
  4. 4. What is an ESB? quot;An Enterprise Service Bus (ESB) is a new architecture that exploits Web services, messaging Service Bus (ESB) is a and transformation. ESBs quot;An Enterprise middleware, intelligent routing, new architecture that act as a lightweight, ubiquitous integration backbone through which software exploits Web services, messaging middleware, intelligent services and application components flow.” (Gartner) routing, and transformation. ESBs act as a lightweight, ubiquitous integration backbone through which software services and application components flow.” (Gartner) 4
  5. 5. What is an ESB? An ESB acts as a shared messaging layer for connecting applications and other services throughout ana sharedcomputing infrastructure. It supplements its An ESB acts as enterprise messaging layer for connecting core asynchronous messaging backbone with intelligent transformation and applications and other services throughout an enterprise routing to ensure messages are passed reliably. Services participate in the ESB using either web services messaging supplements its core computing infrastructure. It standards or JMS (LooselyCoupled.com) asynchronous messaging backbone with intelligent transformation and routing to ensure messages are passed reliably. Services participate in the ESB using either web services messaging standards or JMS (LooselyCoupled.com) 5
  6. 6. What is an ESB? An ESB is an open standards, message-based, distributed, integration solution An ESB is an open standards, message-based, distributed, that provides routing, invocation, and mediation services to facilitate the interactions of disparate distributed information technology resources integration solution that provides routing, invocation, and (applications, services, information, platforms) in a reliable manner. (Brenda Michelson, Elemental Links) facilitate the interactions of disparate mediation services to distributed information technology resources (applications, services, information, platforms) in a reliable manner. (Brenda Michelson, Elemental Links) 6
  7. 7. Do I need an ESB?  ESB Planning Process 7
  8. 8. What is JBI? 8
  9. 9. What is JBI?  JBI defines an architecture that allows the construction of integration systems from plug-in components, that interoperate through the method of mediated message exchange.  (JBI 1.0 Spec) 9
  10. 10. Java Business Integration 10
  11. 11. Java Business Integration 11
  12. 12. JBI Normalized Message 12
  13. 13. JBI Packaging 13
  14. 14. Apache ServiceMix http://servicemix.apache.org/  14
  15. 15. Apache ServiceMix Architecture 15
  16. 16. ServiceMix Features  Supports many protocols  File, FTP, HTTP/S, JMS, SMTP, SOAP, TCP, XMPP  Support many engines  Apache Camel, Apache CXF, Apache ODE, Drools, OS Workflow, POJOs, Quartz, Scripting, Saxon XQuery and XSLT, WS-Notification  Support for Security  JAAS, WS-Security  Web Container/App Server Integration  Geronimo, JBoss, Jetty, Tomcat, Weblogic, Websphere 16
  17. 17. Apache Software Foundation Apache Software Foundation 17
  18. 18. Message Routing 18
  19. 19. Message Routing 19
  20. 20. Example 20
  21. 21. Configuration 21
  22. 22. file-poller-su  <beans xmlns:file='http://servicemix.apache.org/file/1.0'  xmlns:myApp=quot;http://com.mycompany/myappquot;>  <file:poller service=quot;myapp:filequot;  endpoint=quot;pollerquot;  file=quot;file:///Users/bsnyder/poller/inboxquot;  targetService=quot;myapp:wiretapquot;  targetEndpoint=quot;loggerquot; />  </beans> 22
  23. 23. eip-wiretap-su  <beans xmlns:eip=quot;http://servicemix.apache.org/eip/1.0quot;  xmlns:myapp=quot;http://mycompany.com/myappquot;>  <eip:wire-tap service=quot;myapp:wiretapquot; endpoint=quot;endpointquot;>  <eip:target>  <eip:exchange-target service=quot;myapp:cbrquot; />  </eip:target>  <eip:inListener>  <eip:exchange-target service=quot;myapp:persistquot; />  </eip:inListener>  </eip:wire-tap>  </beans> 23
  24. 24. camel-persist-su  public class PersistOrderRoute extends RouteBuilder {  public void configure() {  from(quot;jbi:endpoint:http://mycompany.com/persist/orderquot;)  .convertBodyTo(Order.class)  .to(quot;jpa:com.mycompany.Order?persistenceUnit=order- procquot;)  .convertBodyTo(Order.class);  }}  -------------------------------------------------  <beans xmlns:camel=”http://activemq.apache.org/camelquot;>  <camel:camelContext id=quot;camelquot;>  <package>com.mycompany.persistence</package>  </camel:camelContext>  </beans> 24
  25. 25. eip-cbr-su  <beans xmlns:eip=quot;http://servicemix.apache.org/eip/1.0quot;  xmlns:myapp=quot;http://mycompany.com/myappquot;>  <eip:content-based-router service=quot;myapp:cbrquot;  endpoint=quot;endpointquot;>  <eip:rules>  <eip:routing-rule>  <eip:predicate>  <eip:xpath-predicate  xpath=quot;/message/cheese/text() = 'gouda'quot; />  </eip:predicate>  <eip:target>  <eip:exchange-target service=quot;myapp:queue1quot; />  </eip:target>  </eip:routing-rule>  ... 25
  26. 26. eip-cbr-su  ...  <eip:routing-rule>  <eip:predicate>  <eip:xpath-predicate  xpath=quot;/message/cheese/text() = 'swiss'quot; />  </eip:predicate>  <eip:target>  <eip:exchange-target service=quot;myapp:queue2quot; />  </eip:target>  </eip:routing-rule>  <eip:routing-rule>  <eip:target>  <eip:exchange-target service=quot;myapp:queue3quot; />  </eip:target>  </eip:routing-rule>  </eip:rules>  </eip:content-based-router> 26
  27. 27. jms-producer-su  <beans xmlns:jms=quot;http://servicemix.apache.org/jms/1.0quot;  xmlns:myapp=quot;http://mycompany.com/myapp  xmlns:amq=quot;http://activemq.org/config/1.0quot;>  <jms:endpoint service=quot;myapp:queue1quot;  endpoint=quot;myProviderquot;  role=quot;providerquot;  destinationStyle=quot;queuequot;  jmsProviderDestinationName=quot;queue1quot;  connectionFactory=quot;#connectionFactoryquot; />  <jms:endpoint service=quot;myapp:queue2quot;  endpoint=quot;myProviderquot;  role=quot;providerquot;  destinationStyle=quot;queuequot;  jmsProviderDestinationName=quot;queue2quot;  connectionFactory=quot;#connectionFactoryquot;/> 27
  28. 28. jms-producer-su  ...  <jms:endpoint service=quot;myapp:queue3quot;  endpoint=quot;myProviderquot;  role=quot;providerquot;  destinationStyle=quot;queuequot;  jmsProviderDestinationName=quot;queue3quot;  connectionFactory=quot;#connectionFactoryquot;/>  <amq:connectionFactory id=quot;connectionFactoryquot;  brokerURL=quot;tcp://localhost:61616quot; />  </beans> 28
  29. 29. JBI Packaging 29
  30. 30. Distribution of ServiceMix Containers 30
  31. 31. Eclipse IDE Tooling For ServiceMix  Eclipse SOA Tooling Platform (STP) Project  http://eclipse.org/stp  IONA FUSE Eclipse Tooling  http://open.iona.com/wiki/display/ProdInfo/FUSE+Eclipse+Tools  Spagic  http://spagic.com/  Sopera  http://sopera.de/en/products/sopera-servicemixtools/ Eclipse SOA Tools Platform (STP) Project 31
  32. 32. Eclipse Tooling Eclipse SOA Tools Platform (STP) Project 32
  33. 33. What is Apache Camel? http://activemq.apache.org/camel/  33
  34. 34. What is EIP? 34
  35. 35. Example Pattern: Content Based Router RouteBuilder builder = new RouteBuilder() { public void configure() { from(quot;seda:aquot;).choice() .when(header(quot;fooquot;).isEqualTo(quot;barquot;)).to(quot;seda:bquot;) .when(header(quot;fooquot;).isEqualTo(quot;cheesequot;)).to(quot;seda:cquot;) .otherwise().to(quot;seda:dquot;); } }; 35
  36. 36. Example Pattern: Content Based Router <camelContext id=quot;buildSimpleRouteWithChoicequot; xmlns=quot;http://activemq.apache.org/camel/schema/springquot;> <route> <from uri=quot;seda:aquot;/> <choice> <when> <predicate> <header name=quot;fooquot;/> <isEqualTo value=quot;barquot;/> </predicate> <to uri=quot;seda:bquot;/> </when> <when> <predicate> <header name=quot;fooquot;/> <isEqualTo value=quot;cheesequot;/> </predicate> <to uri=quot;seda:cquot;/> </when> <otherwise><to uri=quot;seda:dquot;/></otherwise> </choice> </route> </camelContext> 36
  37. 37. What’s Coming in ServiceMix 4.0 Apache ServiceMix 4.0 37
  38. 38. ServiceMix 4.0 Building Blocks  Runtime: OSGi (Apache Felix)  JBI support still intact!  NMR is a OSGi service  Message Broker: Apache ActiveMQ  Web Services: Apache CXF  Routing Engine: Apache Camel 38
  39. 39. Thank You for Attending! Questions? 39
  40. 40. Visualization 40
  41. 41. Camel Makes Routing Much Easier! from(“http://localhost:8080/requests/”). tryBlock(). to(“activemq:queue:requests”). setOutBody(constant(“<ack/>”)). handle(Throwable.class). setFaultBody(constant(“<nack/>”)); from((“activemq:queue:requests?transacted=true”). process(requestTransformer). to(“http://host:8080/Request”). filter(xpath(“//nack”)). process(nackTransformer). to(“jdbc:store”); from(“http://localhost:8080/responses/”). tryBlock(). to(“activemq:queue:responses”). setOutBody(constant(“<ack/>”)). handle(Throwable.class). setFaultBody(constant(“<nack/>”)); from(“activemq:queue:responses?transacted=true”). process(responseTransformer). to(“jdbc:store”); from(“http://localhost:8080/pull/”). to(“jdbc:load”); 41

×