Leichtgewichtige Enterprise-Integration mit Apache Camel  Christian Meder | inovex GmbH
Agenda <ul><li>Warum Apache Camel ? </li></ul><ul><li>Enterprise Integration Patterns </li></ul><ul><li>Camel </li></ul><u...
Enterprise-Integration Enterprise Application Integration (EAI)‏ Service Oriented Architecture (SOA)‏ Webservices (WS-*)‏ ...
Nur für Spezialisten ?
Apache Camel
Das Buch Gregor Hohpe, Bobby Woolf Enterprise Integration Patterns “ The Bible for Enterprise Application Integration”  (a...
Cast
Messaging <ul><li>remove </li></ul><ul><li>location dependencies </li></ul><ul><li>data format dependencies </li></ul><ul>...
Enterprise Integration Patterns <ul><li>65 patterns </li></ul><ul><li>Messaging Endpoints </li></ul><ul><li>Message Constr...
Enterprise Integration Patterns  (Basics)‏ <ul><li>Channel </li></ul><ul><li>Message </li></ul><ul><li>Pipes and Filters <...
EIP (Routing/Transformation)‏ <ul><li>Message Filter </li></ul><ul><li>Splitter </li></ul><ul><li>Aggregator </li></ul><ul...
Beispiel (VeS)‏ <ul><li>Vollständig erfundenes Stammdatensystem </li></ul>
Apache Camel <ul><li>Wurzeln in servicemix-eip, activemq </li></ul><ul><li>activemq, servicemix, cxf  communities </li></u...
Camel (Konzepte)‏ <ul><li>CamelContext </li></ul><ul><li>Component </li></ul><ul><li>Endpoint </li></ul><ul><li>Message/Ex...
CamelContext <ul><li>Spring: </li></ul><ul><li><camelContext id=&quot;camel&quot; xmlns=&quot;http://activemq.apache.org/c...
Component <ul><li>Spring: </li></ul><ul><li><bean id=&quot;activemq&quot; class=&quot;org.apache.camel.component.jms.JmsCo...
Endpoint <ul><li>Spring: </li></ul><ul><li><cxf:cxfEndpoint id=&quot;routerEndpoint&quot; address=&quot;http://localhost:9...
Message/Exchange/Processor <ul><li>Pure Java: </li></ul><ul><li>Exchange exchange = endpoint.createExchange(); </li></ul><...
RouteBuilder <ul><li>Spring: </li></ul><ul><li><camelContext xmlns=&quot;http://activemq.apache.org/camel/schema/spring&qu...
RouteBuilder (Java DSL)‏ <ul><li>Pure Java: </li></ul><ul><li>from(&quot;activemq:Input&quot;).beanRef(&quot;myBeanName&qu...
RouteBuilder (Scala DSL beta)‏ <ul><li>class MyRouteBuilder extends RouteBuilder { </li></ul><ul><li>&quot;direct:a&quot; ...
VeS (Splitter)‏ <ul><li><camelContext id=&quot;camel&quot; xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot...
VeS (Router)‏ <ul><li>RouteBuilder builder = new RouteBuilder() { </li></ul><ul><li>public void configure() { </li></ul><u...
VeS (2. Router)‏ <ul><li>RouteBuilder builder = new RouteBuilder() { </li></ul><ul><li>public void configure() { </li></ul...
VeS (Transformation)‏ <ul><li><route> </li></ul><ul><li><from uri=&quot;seda:loginData&quot;/> </li></ul><ul><li><bean ref...
Expression Languages <ul><li>from(&quot;queue:a&quot;).filter( header(&quot;foo&quot;).isEqualTo(&quot;bar&quot;) ).to(&qu...
Components <ul><li>ActiveMQ (activemq:FOO.BAR)‏ </li></ul><ul><li>Atom (atom://atomUri)‏ </li></ul><ul><li>CXF (cxf:bean:c...
Components <ul><li>Flatpack (flatpack:fixed:foo.pzmap.xml)‏ </li></ul><ul><li>FTP (ftp://camelrider@localhost:21/public/do...
Components <ul><li>JMS (jms:FOO.BAR)‏ </li></ul><ul><li>JPA (jpa:account)‏ </li></ul><ul><li>LDAP (ldap:localhost:1024)‏ <...
Components <ul><li>Seda (seda:start)‏ </li></ul><ul><li>Smooks (EDI parsing)‏ </li></ul><ul><li>Test (test:file://data/exp...
Möglichkeiten <ul><li>BAM (Wiretap Pattern)‏ </li></ul><ul><li>Bean Integration </li></ul><ul><li>Visualisierung </li></ul...
Fazit <ul><li>Apache Camel ist </li></ul><ul><li>klein </li></ul><ul><li>leicht </li></ul><ul><li>fokussiert </li></ul><ul...
Credits <ul><li>the camel riders </li></ul><ul><li>IBM System 360 (CC cote on flickr)‏ </li></ul><ul><li>the camel's way (...
Upcoming SlideShare
Loading in...5
×

Apache Camel - WJax 2008

2,231

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,231
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
48
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Apache Camel - WJax 2008

  1. 1. Leichtgewichtige Enterprise-Integration mit Apache Camel Christian Meder | inovex GmbH
  2. 2. Agenda <ul><li>Warum Apache Camel ? </li></ul><ul><li>Enterprise Integration Patterns </li></ul><ul><li>Camel </li></ul><ul><ul><li>Konzepte </li></ul></ul><ul><ul><li>DSL </li></ul></ul><ul><ul><li>Beispiel </li></ul></ul><ul><ul><li>Komponenten </li></ul></ul><ul><ul><li>Möglichkeiten </li></ul></ul><ul><li>Fazit </li></ul>
  3. 3. Enterprise-Integration Enterprise Application Integration (EAI)‏ Service Oriented Architecture (SOA)‏ Webservices (WS-*)‏ Enterprise Service Bus (ESB)‏ Message Oriented Middleware (MOM)‏ XML SOAP WSDL HTTP Binärformate JMS
  4. 4. Nur für Spezialisten ?
  5. 5. Apache Camel
  6. 6. Das Buch Gregor Hohpe, Bobby Woolf Enterprise Integration Patterns “ The Bible for Enterprise Application Integration” (amazon.com)‏
  7. 7. Cast
  8. 8. Messaging <ul><li>remove </li></ul><ul><li>location dependencies </li></ul><ul><li>data format dependencies </li></ul><ul><li>temporal dependencies </li></ul>
  9. 9. Enterprise Integration Patterns <ul><li>65 patterns </li></ul><ul><li>Messaging Endpoints </li></ul><ul><li>Message Construction </li></ul><ul><li>Messaging Channels </li></ul><ul><li>Message Routing </li></ul><ul><li>Message Transformation </li></ul><ul><li>System Management </li></ul>
  10. 10. Enterprise Integration Patterns (Basics)‏ <ul><li>Channel </li></ul><ul><li>Message </li></ul><ul><li>Pipes and Filters </li></ul><ul><li>Message Router </li></ul><ul><li>Message Translator </li></ul><ul><li>Message Endpoint </li></ul>
  11. 11. EIP (Routing/Transformation)‏ <ul><li>Message Filter </li></ul><ul><li>Splitter </li></ul><ul><li>Aggregator </li></ul><ul><li>Resequencer </li></ul><ul><li>Content Enricher </li></ul><ul><li>Content Filter </li></ul><ul><li>Normalizer </li></ul>
  12. 12. Beispiel (VeS)‏ <ul><li>Vollständig erfundenes Stammdatensystem </li></ul>
  13. 13. Apache Camel <ul><li>Wurzeln in servicemix-eip, activemq </li></ul><ul><li>activemq, servicemix, cxf communities </li></ul><ul><li>implementiert 40 EIP </li></ul><ul><li>camel-core: commons-logging, jaxb, activation </li></ul><ul><li>1.3.0 April 2008 (208 tasks), 1.4.0 Juli 2008 (261 tasks), 1.5.0 Oktober 2008 (266 tasks)‏ </li></ul><ul><li>kommerzieller Support </li></ul>
  14. 14. Camel (Konzepte)‏ <ul><li>CamelContext </li></ul><ul><li>Component </li></ul><ul><li>Endpoint </li></ul><ul><li>Message/Exchange </li></ul><ul><li>Processor </li></ul><ul><li>RouteBuilder/Java DSL </li></ul>
  15. 15. CamelContext <ul><li>Spring: </li></ul><ul><li><camelContext id=&quot;camel&quot; xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;> </li></ul><ul><li></camelContext> </li></ul><ul><li>Pure Java: </li></ul><ul><li>CamelContext camel = new DefaultCamelContext(); </li></ul><ul><li>camelContext.start(); </li></ul>
  16. 16. Component <ul><li>Spring: </li></ul><ul><li><bean id=&quot;activemq&quot; class=&quot;org.apache.camel.component.jms.JmsComponent&quot;> </li></ul><ul><li><property name=&quot;connectionFactory&quot;> </li></ul><ul><li><bean class=&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;> </li></ul><ul><li><property name=&quot;brokerURL&quot; value=&quot;vm://localhost?broker.persistent=false&quot;/> </li></ul><ul><li></bean> </li></ul><ul><li></property> </li></ul><ul><li></bean> </li></ul><ul><li>Pure Java: </li></ul><ul><li>Component mailComponent = new org.apache.camel.component.mail.MailComponent(); </li></ul>
  17. 17. Endpoint <ul><li>Spring: </li></ul><ul><li><cxf:cxfEndpoint id=&quot;routerEndpoint&quot; address=&quot;http://localhost:9003/CamelContext/RouterPort&quot; </li></ul><ul><li>serviceClass=&quot;org.apache.hello_world_soap_http.GreeterImpl&quot;/> </li></ul><ul><li>URI: </li></ul><ul><li>cxf:bean:routerEndpoint </li></ul><ul><li>Pure Java: </li></ul><ul><li>Endpoint endpoint = component.createEndpoint(&quot;log:com.mycompany.part2&quot;); </li></ul><ul><li>URI: </li></ul><ul><li>log:com.mycompany.part2 </li></ul>
  18. 18. Message/Exchange/Processor <ul><li>Pure Java: </li></ul><ul><li>Exchange exchange = endpoint.createExchange(); </li></ul><ul><li>exchange.getIn().setBody(name); </li></ul><ul><li>public class MyProcessor implements Processor { </li></ul><ul><li>public void process(Exchange exchange) throws Exception { </li></ul><ul><li>// do something... </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>Processor myProcessor = new MyProcessor(); </li></ul>
  19. 19. RouteBuilder <ul><li>Spring: </li></ul><ul><li><camelContext xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;> </li></ul><ul><li><route> </li></ul><ul><li><from uri=&quot;activemq:Input&quot;/> </li></ul><ul><li><bean ref=&quot;myBeanName&quot; method=&quot;doTransform&quot;/> </li></ul><ul><li><to uri=&quot;activemq:Output&quot;/> </li></ul><ul><li></route> </li></ul><ul><li></camelContext> </li></ul>
  20. 20. RouteBuilder (Java DSL)‏ <ul><li>Pure Java: </li></ul><ul><li>from(&quot;activemq:Input&quot;).beanRef(&quot;myBeanName&quot;, &quot;doTransform&quot;).to(&quot;activemq:Output&quot;); </li></ul><ul><li>RouteBuilder builder = new RouteBuilder() { </li></ul><ul><li>public void configure() { </li></ul><ul><li>from(&quot;queue:a&quot;).filter(header(&quot;foo&quot;).isEqualTo(&quot;bar&quot;)).to(&quot;queue:b&quot;); </li></ul><ul><li>from(&quot;queue:c&quot;).choice()‏ </li></ul><ul><li>.when(header(&quot;foo&quot;).isEqualTo(&quot;bar&quot;)).to(&quot;queue:d&quot;)‏ </li></ul><ul><li>.when(header(&quot;foo&quot;).isEqualTo(&quot;cheese&quot;)).to(&quot;queue:e&quot;)‏ </li></ul><ul><li>.otherwise().to(&quot;queue:f&quot;); </li></ul><ul><li>} </li></ul><ul><li>}; </li></ul><ul><li>myCamelContext.addRoutes(builder); </li></ul>
  21. 21. RouteBuilder (Scala DSL beta)‏ <ul><li>class MyRouteBuilder extends RouteBuilder { </li></ul><ul><li>&quot;direct:a&quot; --> &quot;mock:a&quot; </li></ul><ul><li>&quot;direct:b&quot; to &quot;mock:b&quot; </li></ul><ul><li>} </li></ul>
  22. 22. VeS (Splitter)‏ <ul><li><camelContext id=&quot;camel&quot; xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;> </li></ul><ul><li><route> </li></ul><ul><li><from uri=&quot;cxf:requests&quot;/> </li></ul><ul><li><splitter> </li></ul><ul><li><xpath>/login | /account</xpath> </li></ul><ul><li><to uri=&quot;direct:splitrequest&quot;/> </li></ul><ul><li></splitter> </li></ul><ul><li></route> </li></ul><ul><li></camelContext> </li></ul>
  23. 23. VeS (Router)‏ <ul><li>RouteBuilder builder = new RouteBuilder() { </li></ul><ul><li>public void configure() { </li></ul><ul><li>from(&quot;direct:splitrequest&quot;).choice().when(xpath(&quot;/login&quot;)).to(&quot;seda:loginData&quot;)‏ </li></ul><ul><li>.when(xpath(&quot;/account&quot;)).to(&quot;seda:accountData&quot;); </li></ul><ul><li>} </li></ul><ul><li>}; </li></ul>
  24. 24. VeS (2. Router)‏ <ul><li>RouteBuilder builder = new RouteBuilder() { </li></ul><ul><li>public void configure() { </li></ul><ul><li>from(&quot;seda:accountData&quot;).choice().when(groovy(“request.account.id =~ /A.*/”))‏ </li></ul><ul><li>.to(&quot;seda:oldAccountData&quot;)‏ </li></ul><ul><li>.when(groovy(&quot;request.account.id =~ /B.*/&quot;)).to(&quot;seda:newAccountData&quot;); </li></ul><ul><li>} </li></ul><ul><li>}; </li></ul>
  25. 25. VeS (Transformation)‏ <ul><li><route> </li></ul><ul><li><from uri=&quot;seda:loginData&quot;/> </li></ul><ul><li><bean ref=&quot;loginBackend&quot; method=&quot;doTransform&quot;/> </li></ul><ul><li><to uri=&quot;seda:loginBackend&quot;/> </li></ul><ul><li></route> </li></ul>
  26. 26. Expression Languages <ul><li>from(&quot;queue:a&quot;).filter( header(&quot;foo&quot;).isEqualTo(&quot;bar&quot;) ).to(&quot;queue:b&quot;); </li></ul><ul><li>Expression Language filter().el(&quot;${in.headers['My Header'] == 'bar'}&quot;)‏ </li></ul><ul><li>OGNL filter().ognl(&quot;request.headers.foo = 'bar'&quot;)‏ </li></ul><ul><li>Javascript filter().javaScript(&quot;request.headers.get('user') == 'admin'&quot;)‏ </li></ul><ul><li>Groovy filter().groovy(&quot;request.lineItems.any { i -> i.value > 100 }&quot;)‏ </li></ul><ul><li>Python filter().python(&quot;request.headers['user'] == 'admin'&quot;)‏ </li></ul><ul><li>Ruby filter().ruby(&quot;$request.headers['user'] == 'admin'&quot;)‏ </li></ul><ul><li>Xpath filter().xpath(&quot;//foo&quot;)‏ </li></ul><ul><li>Xquery filter().xquery(&quot;//foo&quot;)‏ </li></ul><ul><li>Scripting languages via JSR223 </li></ul>
  27. 27. Components <ul><li>ActiveMQ (activemq:FOO.BAR)‏ </li></ul><ul><li>Atom (atom://atomUri)‏ </li></ul><ul><li>CXF (cxf:bean:cxfEndpoint)‏ </li></ul><ul><li>Spring events (spring-event://default)‏ </li></ul><ul><li>File ( file://inputdir/?delete=true )‏ </li></ul><ul><li>Financial Information eXchange (fix://configurationResource)‏ </li></ul>
  28. 28. Components <ul><li>Flatpack (flatpack:fixed:foo.pzmap.xml)‏ </li></ul><ul><li>FTP (ftp://camelrider@localhost:21/public/downloads)‏ </li></ul><ul><li>HL7 (Health Level 7)‏ </li></ul><ul><li>HTTP/Jetty </li></ul><ul><li>JBI (jbi:service:http://foo.bar.org/Service)‏ </li></ul><ul><li>Java Content Repository (jcr://user:pass@repository/repo)‏ </li></ul>
  29. 29. Components <ul><li>JMS (jms:FOO.BAR)‏ </li></ul><ul><li>JPA (jpa:account)‏ </li></ul><ul><li>LDAP (ldap:localhost:1024)‏ </li></ul><ul><li>Log (log:org.camel.example.Foo)‏ </li></ul><ul><li>Mail (imap://admin@mymailserver.com)‏ </li></ul><ul><li>Mina (mina:tcp://localhost:6200?textline=true)‏ </li></ul><ul><li>Mock (mock:foo)‏ </li></ul><ul><li>RMI (rmi://localhost:1099/foo)‏ </li></ul>
  30. 30. Components <ul><li>Seda (seda:start)‏ </li></ul><ul><li>Smooks (EDI parsing)‏ </li></ul><ul><li>Test (test:file://data/expectedOutput)‏ </li></ul><ul><li>Timer (timer://foo?fixedRate=true&period=60000)‏ </li></ul><ul><li>Velocity (velocity:com/acme/MyResponse.vm)‏ </li></ul><ul><li>Vm (vm:foo)‏ </li></ul><ul><li>Xmpp (xmpp://fromAlias/toAlias)‏ </li></ul>
  31. 31. Möglichkeiten <ul><li>BAM (Wiretap Pattern)‏ </li></ul><ul><li>Bean Integration </li></ul><ul><li>Visualisierung </li></ul><ul><li>Komponenten- erstellung </li></ul>
  32. 32. Fazit <ul><li>Apache Camel ist </li></ul><ul><li>klein </li></ul><ul><li>leicht </li></ul><ul><li>fokussiert </li></ul><ul><li>modular </li></ul><ul><li>Don't get the hump, try Camel today. </li></ul>
  33. 33. Credits <ul><li>the camel riders </li></ul><ul><li>IBM System 360 (CC cote on flickr)‏ </li></ul><ul><li>the camel's way (CC lovelypetal on flickr)‏ </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×