SlideShare una empresa de Scribd logo
1 de 50
Apache Camel Taking Camel for a ride Hands on Xke Alexis Kinsella June 11, 2010
www.xebia.fr / blog.xebia.fr What is camel ?
What is camel ? www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object]
What is camel ? ,[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
What is camel ? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
www.xebia.fr / blog.xebia.fr Some informations before you start ...
About the authors (Camel Riders) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
About the authors (Camel Riders) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
Camel and friends ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
Professionnal Camel Support ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
Competitors and Families of products ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
Camel compared to Mule ... ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
Camel compared to Mule ... ,[object Object],[object Object],www.xebia.fr / blog.xebia.fr
www.xebia.fr / blog.xebia.fr The basics
Message Routing www.xebia.fr / blog.xebia.fr Endpoint B Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint A Message
Camel Components www.xebia.fr / blog.xebia.fr
Kick Ass features ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
Simple Routing www.xebia.fr / blog.xebia.fr Endpoint B Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint A Message File Jms
Pipeline www.xebia.fr / blog.xebia.fr Endpoint B Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint A Message Endpoint C Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint D Message Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget
Multicast www.xebia.fr / blog.xebia.fr Endpoint B Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint A Message Endpoint B Endpoint B File IBatis SMTP SFTP
Message filter: Spring XML www.xebia.fr / blog.xebia.fr <? xml  version = &quot;1.0&quot;  encoding = &quot;UTF-8&quot; ?> < beans  xmlns = &quot;http://www.springframework.org/schema/beans&quot; xmlns:xsi = &quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:schemaLocation = &quot;…&quot; > < camelContext  xmlns = &quot;http://activemq.apache.org/camel/schema/spring&quot; > < route > < from  uri = &quot;activemq:topic:Quotes&quot;  /> < filter > < xpath > /quote/product = ‘widget’ </ xpath > < to  uri = &quot;mqseries:WidgetQuotes&quot;  /> </ filter > </ route > </ camelContext > </ beans >
Message filter: Java DSL www.xebia.fr / blog.xebia.fr package  com.acme.quotes; import  org.apache.camel.builder.RouteBuilder; public   class  MyRouteBuilder  extends  RouteBuilder { public   void  configure() { // forward widget quotes to MQSeries from( &quot;activemq:topic:Quotes&quot; ). filter().xpath( &quot;/quote/product = ‘widget’&quot; ). to( &quot;mqseries:WidgetQuotes&quot; ); } }
Content Based Router: Java www.xebia.fr / blog.xebia.fr from( &quot;activemq:NewOrders&quot; ). choice().when().xpath( &quot;/quote/product = 'widget'&quot; ). to( &quot;activemq:Orders.Widgets&quot; ). choice().when().xpath( &quot;/quote/product = 'gadget'&quot; ). to( &quot;activemq:Orders.Gadgets&quot; ). otherwise(). to( &quot;activemq:Orders.Bad&quot; );
Content Based Router: Spring XML www.xebia.fr / blog.xebia.fr <? xml  version = &quot;1.0&quot;  encoding = &quot;UTF-8&quot; ?> < beans  xmlns = &quot;http://www.springframework.org/schema/beans&quot; xmlns:xsi = &quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:schemaLocation = &quot;...&quot; > < camelContext  xmlns = &quot;http://activemq.apache.org/camel/schema/spring&quot; > < route > < from  uri = &quot;activemq:NewOrders&quot;  /> < choice > < when > < xpath > /order/product = 'widget' </ xpath > < to  uri = &quot;activemq:Orders.Widgets&quot;  /> </ when > < when > < xpath > /order/product = 'gadget' </ xpath > < to  uri = &quot;activemq:Orders.Gadgets&quot;  /> </ when > < otherwise > < to  uri = &quot;activemq:Orders.Bad&quot;  /> </ otherwise > </ choice > </ route > </ camelContext > </ beans >
How camel do this routing work ? ,[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
Message processors www.xebia.fr / blog.xebia.fr from( &quot;direct:start&quot; ).process( new  Processor() { public   void  process(Exchange exchange) { Message in = exchange.getIn(); in.setBody(in.getBody(String. class ) +  &quot; World!&quot; ); } }).to( &quot;mock:result&quot; ); < bean   id = &quot;myProcessor&quot;   class = &quot;com.acme.MyProcessor&quot; /> from( &quot;activemq:myQueue&quot; ).to( &quot;myProcessor&quot; ); ,[object Object],[object Object],[object Object]
Expressions www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Predicates www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Predicates examples www.xebia.fr / blog.xebia.fr from( &quot;jms:queue:order&quot; ) .choice() .when(header( &quot;type&quot; ).isEqualTo( &quot;widget&quot; )).to( &quot;bean:widgetOrder&quot; ) .when(header( &quot;type&quot; ).isEqualTo( &quot;wombat&quot; )).to( &quot;bean:wombatOrder&quot; ) .otherwise() .to( &quot;bean:miscOrder&quot; ) .end();  Predicate  isWidget  = header( &quot;type&quot; ).isEqualTo( &quot;widget&quot; ); from( &quot;jms:queue:order&quot; ) .choice() .when( isWidget ).to( &quot;bean:widgetOrder&quot; ) .when( isWombat ).to( &quot;bean:wombatOrder&quot; ) .otherwise() .to( &quot;bean:miscOrder&quot; ) .end();
Transaction Oriented Endpoints www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transaction Oriented Endpoints www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transaction Oriented Endpoints www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transaction Oriented Endpoints www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transaction Oriented Endpoints www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transaction Oriented Endpoints www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DefaultErrorHandler & DeadLetterChannel www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Annotation support www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
@Bean annotation www.xebia.fr / blog.xebia.fr public   class  Foo { @ MessageDriven ( uri  =  &quot;activemq:my.queue&quot; ) public   void  doSomething( @Bean ( &quot;myCorrelationIdGenerator&quot; ) String correlationID,  @Body  String body) { // process the  inbound  message here } } public   class  MyIdGenerator { private   UserManager   userManager ; public  String generate( @ Header ( name  =  &quot;user&quot; ) String user,  @Body  String payload)  throws  Exception { User   user  =  userManager .lookupUser(user); String id = user.getPrimaryId() +  generateHashCodeForPayload (payload); return  id; } }
Groovy support www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Testing with camel www.xebia.fr / blog.xebia.fr ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Testing with camel www.xebia.fr / blog.xebia.fr public   class  FilterTest  extends  CamelTestSupport { @EndpointInject (uri =  &quot;mock:result&quot; )  protected  MockEndpoint  resultEndpoint ; @Produce (uri =  &quot;direct:start&quot; )  protected  ProducerTemplate  template ; public   void  testSendMatchingMessage()  throws  Exception { String expectedBody =  &quot;<matched/>&quot; ; resultEndpoint .expectedBodiesReceived(expectedBody); template .sendBodyAndHeader(expectedBody,  &quot;foo&quot; ,  &quot;bar&quot; ); resultEndpoint .assertIsSatisfied(); } public   void  testSendNotMatchingMessage()  throws  Exception { resultEndpoint .expectedMessageCount(0); template .sendBodyAndHeader( &quot;<notMatched/>&quot; ,  &quot;foo&quot; ,  &quot;notMatchedHeaderValue&quot; ); resultEndpoint .assertIsSatisfied(); } @Override protected  RouteBuilder createRouteBuilder() { return   new  RouteBuilder() { public   void  configure() { from( &quot;direct:start&quot; ).filter(header( &quot;foo&quot; ).isEqualTo( &quot;bar&quot; )).to( &quot;mock:result&quot; ); } }; } }
Spring Test with Java Config www.xebia.fr / blog.xebia.fr @ ContextConfiguration (  locations  =  &quot;org.apache.camel.spring.javaconfig.patterns.FilterTest$ContextConfig&quot; ,  loader  =  JavaConfigContextLoader . class ) public   class  FilterTest  extends   AbstractJUnit4SpringContextTests  { @EndpointInject (uri =  &quot;mock:result&quot; )  protected  MockEndpoint  resultEndpoint ; @Produce (uri =  &quot;direct:start&quot; )  protected  ProducerTemplate  template ; @ DirtiesContext @Test public   void  testSendMatchingMessage()  throws  Exception { String expectedBody =  &quot;<matched/>&quot; ; resultEndpoint .expectedBodiesReceived(expectedBody); template .sendBodyAndHeader(expectedBody,  &quot;foo&quot; ,  &quot;bar&quot; ); resultEndpoint .assertIsSatisfied(); } @ Configuration public   static   class  ContextConfig  extends   SingleRouteCamelConfiguration  { @Bean public  RouteBuilder route() { return   new  RouteBuilder() { public   void  configure() { from( &quot;direct:start&quot; ).filter(header( &quot;foo&quot; ).isEqualTo( &quot;bar&quot; )).to( &quot;mock:result&quot; ); } }; } } }
Camel riding from Java ,[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
Camel & Maven ,[object Object],[object Object],www.xebia.fr / blog.xebia.fr <? xml  version = &quot;1.0&quot;  encoding = &quot;UTF-8&quot; ?> < project > < build > < plugins > < plugin > < groupId > org.apache.camel </ groupId > < artifactId > camel- maven-plugin </ artifactId > </ plugin > </ plugins > </ build > < reporting > < plugins > < plugin > < groupId > org.apache.camel </ groupId > < artifactId > camel- maven-plugin </ artifactId > </ plugin > </ plugins > </ reporting > </ project >  
Maven site report ,[object Object],www.xebia.fr / blog.xebia.fr
Where would I use Camel ? ,[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
www.xebia.fr / blog.xebia.fr Going further with Apache Camel …
Books ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
Books ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.xebia.fr / blog.xebia.fr
www.xebia.fr / blog.xebia.fr Twitter: @alexiskinsella Thank You

Más contenido relacionado

La actualidad más candente

Rails engines in large apps
Rails engines in large appsRails engines in large apps
Rails engines in large apps
Enrico Teotti
 

La actualidad más candente (19)

Rails Engines as a way to Micro services
Rails Engines as a way to Micro servicesRails Engines as a way to Micro services
Rails Engines as a way to Micro services
 
Ultra-modern Front-end Dev & Introducing Spar
Ultra-modern Front-end Dev & Introducing SparUltra-modern Front-end Dev & Introducing Spar
Ultra-modern Front-end Dev & Introducing Spar
 
WordPress REST API v2: Overview & Exploring
WordPress REST API v2: Overview & ExploringWordPress REST API v2: Overview & Exploring
WordPress REST API v2: Overview & Exploring
 
Apache Sling - The whys and the hows
Apache Sling - The whys and the howsApache Sling - The whys and the hows
Apache Sling - The whys and the hows
 
Rails Engines
Rails EnginesRails Engines
Rails Engines
 
عرض حول وردبريس
عرض حول وردبريسعرض حول وردبريس
عرض حول وردبريس
 
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
 
Rails engines in large apps
Rails engines in large appsRails engines in large apps
Rails engines in large apps
 
Web components with Angular
Web components with AngularWeb components with Angular
Web components with Angular
 
Etech2005
Etech2005Etech2005
Etech2005
 
Code diving in Ruby and Rails
Code diving in Ruby and RailsCode diving in Ruby and Rails
Code diving in Ruby and Rails
 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
Sinatra for REST services
Sinatra for REST servicesSinatra for REST services
Sinatra for REST services
 
Introduction to afp
Introduction to afpIntroduction to afp
Introduction to afp
 
EEA Volto Add-ons - Plone Conference 2020
EEA Volto Add-ons - Plone Conference 2020EEA Volto Add-ons - Plone Conference 2020
EEA Volto Add-ons - Plone Conference 2020
 
Full slidescr16
Full slidescr16Full slidescr16
Full slidescr16
 
SCA Reaches the Cloud
SCA Reaches the CloudSCA Reaches the Cloud
SCA Reaches the Cloud
 
Teaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in TitaniumTeaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in Titanium
 
- Webexpo 2010
- Webexpo 2010- Webexpo 2010
- Webexpo 2010
 

Destacado

Workshop apache camel
Workshop apache camelWorkshop apache camel
Workshop apache camel
Marko Seifert
 
Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a Ride
Bruce Snyder
 
Self Repairing Tree Topology Enabling Content Based Routing In Local Area Ne...
Self Repairing Tree Topology Enabling  Content Based Routing In Local Area Ne...Self Repairing Tree Topology Enabling  Content Based Routing In Local Area Ne...
Self Repairing Tree Topology Enabling Content Based Routing In Local Area Ne...
ncct
 
Tml for Ruby on Rails
Tml for Ruby on RailsTml for Ruby on Rails
Tml for Ruby on Rails
Michael Berkovich
 

Destacado (20)

An introduction to Apache Camel
An introduction to Apache CamelAn introduction to Apache Camel
An introduction to Apache Camel
 
Cbr
CbrCbr
Cbr
 
Workshop apache camel
Workshop apache camelWorkshop apache camel
Workshop apache camel
 
Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a Ride
 
Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache Camel
 
Apache camel
Apache camelApache camel
Apache camel
 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A Ride
 
«Spring Integration as Integration Patterns Provider»
«Spring Integration as Integration Patterns Provider»«Spring Integration as Integration Patterns Provider»
«Spring Integration as Integration Patterns Provider»
 
Apache Camel Lifecycle
Apache Camel LifecycleApache Camel Lifecycle
Apache Camel Lifecycle
 
Apache Camel & The Art of Entreprise Integration
Apache Camel & The Art of Entreprise IntegrationApache Camel & The Art of Entreprise Integration
Apache Camel & The Art of Entreprise Integration
 
Wild Flies and a Camel Java EE Integration Stories
Wild Flies and a Camel Java EE Integration StoriesWild Flies and a Camel Java EE Integration Stories
Wild Flies and a Camel Java EE Integration Stories
 
Self Repairing Tree Topology Enabling Content Based Routing In Local Area Ne...
Self Repairing Tree Topology Enabling  Content Based Routing In Local Area Ne...Self Repairing Tree Topology Enabling  Content Based Routing In Local Area Ne...
Self Repairing Tree Topology Enabling Content Based Routing In Local Area Ne...
 
Messaging with Spring Integration
Messaging with Spring IntegrationMessaging with Spring Integration
Messaging with Spring Integration
 
Apache Camel
Apache CamelApache Camel
Apache Camel
 
Spring Integration and EIP Introduction
Spring Integration and EIP IntroductionSpring Integration and EIP Introduction
Spring Integration and EIP Introduction
 
Elegant Systems Integration w/ Apache Camel
Elegant Systems Integration w/ Apache CamelElegant Systems Integration w/ Apache Camel
Elegant Systems Integration w/ Apache Camel
 
Consuming External Content and Enriching Content with Apache Camel
Consuming External Content and Enriching Content with Apache CamelConsuming External Content and Enriching Content with Apache Camel
Consuming External Content and Enriching Content with Apache Camel
 
Event Driven Architecture with Apache Camel
Event Driven Architecture with Apache CamelEvent Driven Architecture with Apache Camel
Event Driven Architecture with Apache Camel
 
Tml for Ruby on Rails
Tml for Ruby on RailsTml for Ruby on Rails
Tml for Ruby on Rails
 
Apache Camel - The integration library
Apache Camel - The integration libraryApache Camel - The integration library
Apache Camel - The integration library
 

Similar a Xke - Introduction to Apache Camel

Jazoon2010 - Edgar Silva - Open source SOA on Steroids
Jazoon2010 - Edgar Silva - Open source SOA on SteroidsJazoon2010 - Edgar Silva - Open source SOA on Steroids
Jazoon2010 - Edgar Silva - Open source SOA on Steroids
Edgar Silva
 
Implementing WebServices with Camel and CXF in ServiceMix
Implementing WebServices with Camel and CXF in ServiceMixImplementing WebServices with Camel and CXF in ServiceMix
Implementing WebServices with Camel and CXF in ServiceMix
Adrian Trenaman
 
ServiceMix 4 -- Integrating OSGi with JBI
ServiceMix 4 -- Integrating OSGi with JBIServiceMix 4 -- Integrating OSGi with JBI
ServiceMix 4 -- Integrating OSGi with JBI
Gert Vanthienen
 
What's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon TalkWhat's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon Talk
Sam Basu
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008
inovex GmbH
 
Ta Javaserverside Eran Toch
Ta Javaserverside Eran TochTa Javaserverside Eran Toch
Ta Javaserverside Eran Toch
Adil Jafri
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 

Similar a Xke - Introduction to Apache Camel (20)

Jazoon2010 - Edgar Silva - Open source SOA on Steroids
Jazoon2010 - Edgar Silva - Open source SOA on SteroidsJazoon2010 - Edgar Silva - Open source SOA on Steroids
Jazoon2010 - Edgar Silva - Open source SOA on Steroids
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
 
Implementing WebServices with Camel and CXF in ServiceMix
Implementing WebServices with Camel and CXF in ServiceMixImplementing WebServices with Camel and CXF in ServiceMix
Implementing WebServices with Camel and CXF in ServiceMix
 
ServiceMix 4 -- Integrating OSGi with JBI
ServiceMix 4 -- Integrating OSGi with JBIServiceMix 4 -- Integrating OSGi with JBI
ServiceMix 4 -- Integrating OSGi with JBI
 
Service Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixService Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMix
 
Riding Apache Camel
Riding Apache CamelRiding Apache Camel
Riding Apache Camel
 
Creating Yahoo Mobile Widgets
Creating Yahoo Mobile WidgetsCreating Yahoo Mobile Widgets
Creating Yahoo Mobile Widgets
 
Apache ServiceMix4 : Dream platform for Java Integration
Apache ServiceMix4 : Dream platform for Java Integration Apache ServiceMix4 : Dream platform for Java Integration
Apache ServiceMix4 : Dream platform for Java Integration
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
 
Introductiontoapachecamel 110131060022-phpapp01
Introductiontoapachecamel 110131060022-phpapp01Introductiontoapachecamel 110131060022-phpapp01
Introductiontoapachecamel 110131060022-phpapp01
 
Internet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyInternet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian Thilmany
 
What's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon TalkWhat's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon Talk
 
Are you new to Apache Camel
Are you new to Apache CamelAre you new to Apache Camel
Are you new to Apache Camel
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008
 
Ta Javaserverside Eran Toch
Ta Javaserverside Eran TochTa Javaserverside Eran Toch
Ta Javaserverside Eran Toch
 
Transforming WebSockets
Transforming WebSocketsTransforming WebSockets
Transforming WebSockets
 
Enterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript DevelopersEnterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript Developers
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
Best Practices for Middleware and Integration Architecture Modernization with...
Best Practices for Middleware and Integration Architecture Modernization with...Best Practices for Middleware and Integration Architecture Modernization with...
Best Practices for Middleware and Integration Architecture Modernization with...
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Xke - Introduction to Apache Camel

  • 1. Apache Camel Taking Camel for a ride Hands on Xke Alexis Kinsella June 11, 2010
  • 3.
  • 4.
  • 5.
  • 6. www.xebia.fr / blog.xebia.fr Some informations before you start ...
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 15. Message Routing www.xebia.fr / blog.xebia.fr Endpoint B Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint A Message
  • 16. Camel Components www.xebia.fr / blog.xebia.fr
  • 17.
  • 18. Simple Routing www.xebia.fr / blog.xebia.fr Endpoint B Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint A Message File Jms
  • 19. Pipeline www.xebia.fr / blog.xebia.fr Endpoint B Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint A Message Endpoint C Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint D Message Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget
  • 20. Multicast www.xebia.fr / blog.xebia.fr Endpoint B Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed magna urna, varius a facilisis nec, sagittis eget eros. Mauris scelerisque justo et ipsum scelerisque aliquam. In at auctor diam. Suspendisse ut justo sed diam Endpoint A Message Endpoint B Endpoint B File IBatis SMTP SFTP
  • 21. Message filter: Spring XML www.xebia.fr / blog.xebia.fr <? xml version = &quot;1.0&quot; encoding = &quot;UTF-8&quot; ?> < beans xmlns = &quot;http://www.springframework.org/schema/beans&quot; xmlns:xsi = &quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:schemaLocation = &quot;…&quot; > < camelContext xmlns = &quot;http://activemq.apache.org/camel/schema/spring&quot; > < route > < from uri = &quot;activemq:topic:Quotes&quot; /> < filter > < xpath > /quote/product = ‘widget’ </ xpath > < to uri = &quot;mqseries:WidgetQuotes&quot; /> </ filter > </ route > </ camelContext > </ beans >
  • 22. Message filter: Java DSL www.xebia.fr / blog.xebia.fr package com.acme.quotes; import org.apache.camel.builder.RouteBuilder; public class MyRouteBuilder extends RouteBuilder { public void configure() { // forward widget quotes to MQSeries from( &quot;activemq:topic:Quotes&quot; ). filter().xpath( &quot;/quote/product = ‘widget’&quot; ). to( &quot;mqseries:WidgetQuotes&quot; ); } }
  • 23. Content Based Router: Java www.xebia.fr / blog.xebia.fr from( &quot;activemq:NewOrders&quot; ). choice().when().xpath( &quot;/quote/product = 'widget'&quot; ). to( &quot;activemq:Orders.Widgets&quot; ). choice().when().xpath( &quot;/quote/product = 'gadget'&quot; ). to( &quot;activemq:Orders.Gadgets&quot; ). otherwise(). to( &quot;activemq:Orders.Bad&quot; );
  • 24. Content Based Router: Spring XML www.xebia.fr / blog.xebia.fr <? xml version = &quot;1.0&quot; encoding = &quot;UTF-8&quot; ?> < beans xmlns = &quot;http://www.springframework.org/schema/beans&quot; xmlns:xsi = &quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:schemaLocation = &quot;...&quot; > < camelContext xmlns = &quot;http://activemq.apache.org/camel/schema/spring&quot; > < route > < from uri = &quot;activemq:NewOrders&quot; /> < choice > < when > < xpath > /order/product = 'widget' </ xpath > < to uri = &quot;activemq:Orders.Widgets&quot; /> </ when > < when > < xpath > /order/product = 'gadget' </ xpath > < to uri = &quot;activemq:Orders.Gadgets&quot; /> </ when > < otherwise > < to uri = &quot;activemq:Orders.Bad&quot; /> </ otherwise > </ choice > </ route > </ camelContext > </ beans >
  • 25.
  • 26.
  • 27.
  • 28.
  • 29. Predicates examples www.xebia.fr / blog.xebia.fr from( &quot;jms:queue:order&quot; ) .choice() .when(header( &quot;type&quot; ).isEqualTo( &quot;widget&quot; )).to( &quot;bean:widgetOrder&quot; ) .when(header( &quot;type&quot; ).isEqualTo( &quot;wombat&quot; )).to( &quot;bean:wombatOrder&quot; ) .otherwise() .to( &quot;bean:miscOrder&quot; ) .end(); Predicate isWidget = header( &quot;type&quot; ).isEqualTo( &quot;widget&quot; ); from( &quot;jms:queue:order&quot; ) .choice() .when( isWidget ).to( &quot;bean:widgetOrder&quot; ) .when( isWombat ).to( &quot;bean:wombatOrder&quot; ) .otherwise() .to( &quot;bean:miscOrder&quot; ) .end();
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38. @Bean annotation www.xebia.fr / blog.xebia.fr public class Foo { @ MessageDriven ( uri = &quot;activemq:my.queue&quot; ) public void doSomething( @Bean ( &quot;myCorrelationIdGenerator&quot; ) String correlationID, @Body String body) { // process the inbound message here } } public class MyIdGenerator { private UserManager userManager ; public String generate( @ Header ( name = &quot;user&quot; ) String user, @Body String payload) throws Exception { User user = userManager .lookupUser(user); String id = user.getPrimaryId() + generateHashCodeForPayload (payload); return id; } }
  • 39.
  • 40.
  • 41. Testing with camel www.xebia.fr / blog.xebia.fr public class FilterTest extends CamelTestSupport { @EndpointInject (uri = &quot;mock:result&quot; ) protected MockEndpoint resultEndpoint ; @Produce (uri = &quot;direct:start&quot; ) protected ProducerTemplate template ; public void testSendMatchingMessage() throws Exception { String expectedBody = &quot;<matched/>&quot; ; resultEndpoint .expectedBodiesReceived(expectedBody); template .sendBodyAndHeader(expectedBody, &quot;foo&quot; , &quot;bar&quot; ); resultEndpoint .assertIsSatisfied(); } public void testSendNotMatchingMessage() throws Exception { resultEndpoint .expectedMessageCount(0); template .sendBodyAndHeader( &quot;<notMatched/>&quot; , &quot;foo&quot; , &quot;notMatchedHeaderValue&quot; ); resultEndpoint .assertIsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { from( &quot;direct:start&quot; ).filter(header( &quot;foo&quot; ).isEqualTo( &quot;bar&quot; )).to( &quot;mock:result&quot; ); } }; } }
  • 42. Spring Test with Java Config www.xebia.fr / blog.xebia.fr @ ContextConfiguration ( locations = &quot;org.apache.camel.spring.javaconfig.patterns.FilterTest$ContextConfig&quot; , loader = JavaConfigContextLoader . class ) public class FilterTest extends AbstractJUnit4SpringContextTests { @EndpointInject (uri = &quot;mock:result&quot; ) protected MockEndpoint resultEndpoint ; @Produce (uri = &quot;direct:start&quot; ) protected ProducerTemplate template ; @ DirtiesContext @Test public void testSendMatchingMessage() throws Exception { String expectedBody = &quot;<matched/>&quot; ; resultEndpoint .expectedBodiesReceived(expectedBody); template .sendBodyAndHeader(expectedBody, &quot;foo&quot; , &quot;bar&quot; ); resultEndpoint .assertIsSatisfied(); } @ Configuration public static class ContextConfig extends SingleRouteCamelConfiguration { @Bean public RouteBuilder route() { return new RouteBuilder() { public void configure() { from( &quot;direct:start&quot; ).filter(header( &quot;foo&quot; ).isEqualTo( &quot;bar&quot; )).to( &quot;mock:result&quot; ); } }; } } }
  • 43.
  • 44.
  • 45.
  • 46.
  • 47. www.xebia.fr / blog.xebia.fr Going further with Apache Camel …
  • 48.
  • 49.
  • 50. www.xebia.fr / blog.xebia.fr Twitter: @alexiskinsella Thank You

Notas del editor

  1. 06/10/10
  2. 06/10/10
  3. 06/10/10
  4. 06/10/10
  5. 06/10/10
  6. 06/10/10
  7. 06/10/10
  8. 06/10/10
  9. 06/10/10
  10. 06/10/10
  11. 06/10/10
  12. 06/10/10
  13. 06/10/10
  14. 06/10/10
  15. 06/10/10
  16. 06/10/10
  17. 06/10/10
  18. 06/10/10
  19. 06/10/10
  20. 06/10/10
  21. 06/10/10
  22. 06/10/10
  23. 06/10/10
  24. 06/10/10
  25. 06/10/10
  26. 06/10/10
  27. 06/10/10
  28. 06/10/10
  29. 06/10/10
  30. 06/10/10
  31. 06/10/10
  32. 06/10/10
  33. 06/10/10
  34. 06/10/10
  35. 06/10/10
  36. 06/10/10
  37. 06/10/10
  38. 06/10/10
  39. 06/10/10
  40. 06/10/10
  41. 06/10/10
  42. 06/10/10
  43. 06/10/10
  44. 06/10/10
  45. 06/10/10
  46. 06/10/10
  47. 06/10/10
  48. 06/10/10
  49. 06/10/10
  50. 06/10/10