SlideShare a Scribd company logo
1 of 43
Download to read offline
Taking Apache Camel
     For a Ride




        Bruce Snyder
     bsnyder@apache.org
         3 June 2008      1
Integration is Messy!




                        2
System Integration




                     3
Data Formats




               4
Apache Camel




        http://activemq.apache.org/camel/
                                            5
What is
Apache
Camel?
          6
Enterprise Integration Patterns




          http://enterpriseintegrationpatterns.com/

                                                      7
Patterns




           8
Message Routing




                  9
Language Support


 โ€ข   BeanShell     โ€ข   SQL
 โ€ข   Javascript    โ€ข   XPath
 โ€ข   Groovy        โ€ข   XQuery
 โ€ข   Python        โ€ข   OGNL
 โ€ข   PHP           โ€ข   JSR 223 scripting
 โ€ข   Ruby




                                           10
Apache Camel Components




       http://activemq.apache.org/camel/components.html



                                                          11
History of Apache Camel




                          12
The Camel Context



CamelContext context = new DefaultCamelContext();
context.addRoutes(new MyRouteBuilder());
context.start();




<camelContext
  xmlns=quot;http://activemq.apache.org/camel/schema/springquot;>
  <package>com.acme.quotes</package>
</camelContext>




                                                            13
Pattern
Examples
           14
Patterns Again




                 15
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;);
        }
   };


                                                    16
Content Based Router

  <camelContext
    xmlns=quot;http://activemq.apache.org/camel/schema/springquot;>
    <route>
      <from uri=quot;activemq:NewOrdersquot;/>
      <choice>
        <when>
          <xpath>/order/product = 'widget'</xpath>
          <to uri=quot;activemq:Orders.Widgetsquot;/>
        </when>
        <when>
          <xpath>/order/product = 'gadget'</xpath>
          <to uri=quot;activemq:Orders.Gadgetsquot;/>
        </when>
        <otherwise>
          <to uri=quot;activemq:Orders.Badquot;/>
        </otherwise>
      </choice>
    </route>
  </camelContext>



                                                              17
Message Filter




public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
        from(quot;activemq:topic:Quotes).
            filter().xpath(quot;/quote/product = โ€˜widgetโ€™quot;).
                to(quot;mqseries:WidgetQuotesquot;);
  }
}




                                                           18
Message Filter

 <camelContext
   xmlns=quot;http://activemq.apache.org/camel/schema/springquot;>
     <route>
       <from uri=quot;activemq:topic:Quotesquot;/>
       <filter>
         <xpath>/quote/product = โ€˜widgetโ€™</xpath>
         <to uri=quot;mqseries:WidgetQuotesquot;/>
       </filter>
     </route>
   </camelContext>




                                                             19
Splitter




public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
      from(quot;file://ordersquot;).
        splitter(body().tokenize(quot;nquot;)).
          to(quot;activemq:Order.Itemsquot;);
    }
  }


                                                     20
Splitter Using XQuery



public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
      from(quot;file://ordersquot;).
        splitter().xquery(quot;/order/itemsquot;).
          to(quot;activemq:Order.Itemsquot;);
    }
  }




                                                     21
Aggregator




public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
      from(quot;activemq:Inventory.Itemsquot;).
        aggregator().xpath(quot;/order/@idquot;).
          to(quot;activemq:Inventory.Orderquot;);
    }
  }




                                                     22
Message Translator




public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
      from(quot;file://incomingโ€).
        to(quot;xslt:com/acme/mytransform.xslquot;).
          to(quot;http://outgoing.com/fooquot;);
    }
  }




                                                     23
Resequencer




public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
      from(quot;direct:aโ€).
        resequencer(header(quot;JMSPriorityquot;)).
          to(quot;seda:bquot;);
    }
  }



                                                     24
Throttler



public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
      from(quot;seda:aโ€).
        throttler(3).timePeriodMillis(30000).
          to(quot;seda:bquot;);
    }
  }




                                                     25
Delayer



public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
      from(quot;seda:aโ€).
        delayer(header(quot;JMSTimestampquot;, 3000).
          to(quot;seda:bquot;);
    }
  }




                                                     26
Combine Patterns



public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
      from(quot;seda:aโ€).
        resequencer(header(quot;JMSPriorityquot;)).
        delayer(3000).
          to(quot;seda:bquot;);
    }
  }




                                                     27
Beans




        28
Bean


  package com.mycompany.beans;

  public class MyBean {

      public void someMethod(String name) {
        ...
      }
  }



<camelContext
  xmlns=quot;http://activemq.apache.org/camel/schema/springquot;>
  <package>com.mycompany.beans</package>
</camelContext>



                                                            29
Bean as a Message Translator



public class MyRouteBuilder extends RouteBuilder {
    public void configure() {
      from(quot;activemq:Incomingโ€).
        beanRef(quot;myBeanquot;).
          to(quot;activemq:Outgoingquot;);
    }
  }




                                                     30
Bean as a Message Translator


 *With Method Name


   public class MyRouteBuilder extends RouteBuilder {
       public void configure() {
           from(quot;activemq:Incomingโ€).
             beanRef(quot;myBeanquot;, quot;someMethodquot;).
               to(quot;activemq:Outgoingquot;);
       }
   }




                                                        31
Type Conversion




                  32
Type Conversion

@Converter
public class IOConverter {

    @Converter
    public static InputStream toInputStream(File file)
      throws FileNotFoundException {
        return new BufferedInputStream(
          new FileInputStream(file));
      }
}




                                                         33
Binding Beans to Camel Endpoints

public class Foo {

    @MessageDriven(uri=quot;activemq:cheesequot;)
    public void onCheese(String name) {
      ...
    }
}




                                            34
Binding Method Arguments

public class Foo {

    public void onCheese(
      @XPath(quot;/foo/barquot;) String name,
      @Header(quot;JMSCorrelationIDquot;) String id) {
      ...
    }
}




            http://activemq.apache.org/camel/bean-integration.html


                                                                     35
Injecting Endpoints Into Beans


  public class Foo {
    @EndpointInject(uri=quot;activemq:foo.barquot;)
    ProducerTemplate producer;

      public void doSomething() {
        if (whatever) {
          producer.sendBody(quot;<hello>world!</hello>quot;);
        }
      }
  }




                                                        36
Spring Remoting - Server Side


 <camelContext
   xmlns=quot;http://activemq.apache.org/camel/schema/springquot;>
   <export id=quot;sayServicequot;
     uri=quot;activemq:MyServicequot;
     serviceRef=quot;sayImplquot;
     serviceInterface=quot;com.acme.MyServiceInterfacequot;/>
 </camelContext>

 <bean id=quot;sayImplquot; class=quot;com.acme.MyServiceImplquot;/>




                                                             37
Spring Remoting - Client Side


 <camelContext
   xmlns=quot;http://activemq.apache.org/camel/schema/springquot;>
   <proxy id=quot;sayServicequot; serviceUrl=quot;activemq:MyServicequot;
     serviceInterface=quot;com.acme.MyServiceInterfacequot;/>
 </camelContext>




                                                             38
Dependency Injection

<camelContext
  xmlns=quot;http://activemq.apache.org/camel/schema/springquot;>
  ...
</camelContext>

<bean id=quot;activemqquot;
  class=quot;org.apache.camel.component.jms.JmsComponentquot;>
  <property name=quot;connectionFactoryquot;>
    <bean class=quot;org.apache.activemq.ActiveMQConnectionFactoryquot;>
      <property name=quot;brokerURLquot;
                value=quot;vm://localhost?broker.persistent=falsequot;/>
    </bean>
  </property>
</bean>




                                                                   39
Business Activity Monitoring (BAM)




                                     40
Business Activity Monitoring (BAM)


public class MyActivities extends ProcessBuilder {

    public void configure() throws Exception {

        // lets define some activities, correlating on an
        // XPath query of the message body
        ActivityBuilder purchaseOrder = activity(quot;activemq:PurchaseOrdersquot;)
                .correlate(xpath(quot;/purchaseOrder/@idquot;).stringResult());

        ActivityBuilder invoice = activity(quot;activemq:Invoicesquot;)
                .correlate(xpath(quot;/invoice/@purchaseOrderIdquot;).stringResult());

        // now lets add some BAM rules
        invoice.starts().after(purchaseOrder.completes())
                .expectWithin(seconds(1))
                .errorIfOver(seconds(2)).to(quot;activemq:FailedProcessesquot;);
    }
}




                                                                                 41
Ride the Camel!




                  42
Questions?




             43

More Related Content

What's hot

Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containersDeveloping Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containersClaus Ibsen
ย 
Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache CamelRosen Spasov
ย 
Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014Claus Ibsen
ย 
System Integration with Akka and Apache Camel
System Integration with Akka and Apache CamelSystem Integration with Akka and Apache Camel
System Integration with Akka and Apache Camelkrasserm
ย 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - CopenhagenClaus Ibsen
ย 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and GroovyClaus Ibsen
ย 
I can't believe it's not a queue: Kafka and Spring
I can't believe it's not a queue: Kafka and SpringI can't believe it's not a queue: Kafka and Spring
I can't believe it's not a queue: Kafka and SpringJoe Kutner
ย 
State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)Claus Ibsen
ย 
Apache Camel K - Fredericia
Apache Camel K - FredericiaApache Camel K - Fredericia
Apache Camel K - FredericiaClaus Ibsen
ย 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebeanFaren faren
ย 
Java Play Restful JPA
Java Play Restful JPAJava Play Restful JPA
Java Play Restful JPAFaren faren
ย 
Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013Claus Ibsen
ย 
Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...All Things Open
ย 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsSadayuki Furuhashi
ย 
Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0Oscar Renalias
ย 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play appsYevgeniy Brikman
ย 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play frameworkFelipe
ย 
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014Claus Ibsen
ย 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akkanartamonov
ย 

What's hot (20)

Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containersDeveloping Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
ย 
Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache Camel
ย 
Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014Getting Started with Apache Camel at DevNation 2014
Getting Started with Apache Camel at DevNation 2014
ย 
System Integration with Akka and Apache Camel
System Integration with Akka and Apache CamelSystem Integration with Akka and Apache Camel
System Integration with Akka and Apache Camel
ย 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - Copenhagen
ย 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
ย 
I can't believe it's not a queue: Kafka and Spring
I can't believe it's not a queue: Kafka and SpringI can't believe it's not a queue: Kafka and Spring
I can't believe it's not a queue: Kafka and Spring
ย 
State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)State of integration with Apache Camel (ApacheCon 2019)
State of integration with Apache Camel (ApacheCon 2019)
ย 
Apache Camel K - Fredericia
Apache Camel K - FredericiaApache Camel K - Fredericia
Apache Camel K - Fredericia
ย 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebean
ย 
Java Play Restful JPA
Java Play Restful JPAJava Play Restful JPA
Java Play Restful JPA
ย 
Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013Getting Started with Apache Camel - Devconf Conference - February 2013
Getting Started with Apache Camel - Devconf Conference - February 2013
ย 
Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...Leveraging Open Source for Database Development: Database Version Control wit...
Leveraging Open Source for Database Development: Database Version Control wit...
ย 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
ย 
Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0Asynchronous web apps with the Play Framework 2.0
Asynchronous web apps with the Play Framework 2.0
ย 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play apps
ย 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play framework
ย 
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
ย 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akka
ย 
Scala active record
Scala active recordScala active record
Scala active record
ย 

Similar to DOSUG Taking Apache Camel For A Ride

Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a RideBruce Snyder
ย 
Using Enterprise Integration Patterns as Your Camel Jockey
Using Enterprise Integration Patterns as Your Camel JockeyUsing Enterprise Integration Patterns as Your Camel Jockey
Using Enterprise Integration Patterns as Your Camel JockeyBruce Snyder
ย 
Aimaf
AimafAimaf
AimafSaad RGUIG
ย 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A RideBruce Snyder
ย 
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19confluent
ย 
Red Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop LabsRed Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop LabsJudy Breedlove
ย 
Rails 6 frontend frameworks
Rails 6 frontend frameworksRails 6 frontend frameworks
Rails 6 frontend frameworksEric Guo
ย 
G*ใƒฏใƒผใ‚ฏใ‚ทใƒงใƒƒใƒ— in ไป™ๅฐ Grails(ใจใ“ใจใ‚“)ๅ…ฅ้–€
G*ใƒฏใƒผใ‚ฏใ‚ทใƒงใƒƒใƒ— in ไป™ๅฐ Grails(ใจใ“ใจใ‚“)ๅ…ฅ้–€G*ใƒฏใƒผใ‚ฏใ‚ทใƒงใƒƒใƒ— in ไป™ๅฐ Grails(ใจใ“ใจใ‚“)ๅ…ฅ้–€
G*ใƒฏใƒผใ‚ฏใ‚ทใƒงใƒƒใƒ— in ไป™ๅฐ Grails(ใจใ“ใจใ‚“)ๅ…ฅ้–€Tsuyoshi Yamamoto
ย 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenJoshua Long
ย 
Service-Oriented Integration With Apache ServiceMix
Service-Oriented Integration With Apache ServiceMixService-Oriented Integration With Apache ServiceMix
Service-Oriented Integration With Apache ServiceMixBruce Snyder
ย 
Service Oriented Integration with ServiceMix
Service Oriented Integration with ServiceMixService Oriented Integration with ServiceMix
Service Oriented Integration with ServiceMixghessler
ย 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsIMC Institute
ย 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'sAntรดnio Roberto Silva
ย 
Spring-training-in-bangalore
Spring-training-in-bangaloreSpring-training-in-bangalore
Spring-training-in-bangaloreTIB Academy
ย 
What's new in jQuery 1.5
What's new in jQuery 1.5What's new in jQuery 1.5
What's new in jQuery 1.5Martin Kleppe
ย 
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code ExampleMaven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code ExampleNikhil Bhalwankar
ย 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSuzquiano
ย 
Testing microservices: Tools and Frameworks
Testing microservices: Tools and FrameworksTesting microservices: Tools and Frameworks
Testing microservices: Tools and FrameworksPiotr Miล„kowski
ย 

Similar to DOSUG Taking Apache Camel For A Ride (20)

Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a Ride
ย 
Using Enterprise Integration Patterns as Your Camel Jockey
Using Enterprise Integration Patterns as Your Camel JockeyUsing Enterprise Integration Patterns as Your Camel Jockey
Using Enterprise Integration Patterns as Your Camel Jockey
ย 
Aimaf
AimafAimaf
Aimaf
ย 
Taking Apache Camel For A Ride
Taking Apache Camel For A RideTaking Apache Camel For A Ride
Taking Apache Camel For A Ride
ย 
Riding Apache Camel
Riding Apache CamelRiding Apache Camel
Riding Apache Camel
ย 
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19
ย 
Red Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop LabsRed Hat Agile integration Workshop Labs
Red Hat Agile integration Workshop Labs
ย 
Rails 6 frontend frameworks
Rails 6 frontend frameworksRails 6 frontend frameworks
Rails 6 frontend frameworks
ย 
G*ใƒฏใƒผใ‚ฏใ‚ทใƒงใƒƒใƒ— in ไป™ๅฐ Grails(ใจใ“ใจใ‚“)ๅ…ฅ้–€
G*ใƒฏใƒผใ‚ฏใ‚ทใƒงใƒƒใƒ— in ไป™ๅฐ Grails(ใจใ“ใจใ‚“)ๅ…ฅ้–€G*ใƒฏใƒผใ‚ฏใ‚ทใƒงใƒƒใƒ— in ไป™ๅฐ Grails(ใจใ“ใจใ‚“)ๅ…ฅ้–€
G*ใƒฏใƒผใ‚ฏใ‚ทใƒงใƒƒใƒ— in ไป™ๅฐ Grails(ใจใ“ใจใ‚“)ๅ…ฅ้–€
ย 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in Heaven
ย 
Service-Oriented Integration With Apache ServiceMix
Service-Oriented Integration With Apache ServiceMixService-Oriented Integration With Apache ServiceMix
Service-Oriented Integration With Apache ServiceMix
ย 
Service Oriented Integration with ServiceMix
Service Oriented Integration with ServiceMixService Oriented Integration with ServiceMix
Service Oriented Integration with ServiceMix
ย 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom Tags
ย 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
ย 
Spring-training-in-bangalore
Spring-training-in-bangaloreSpring-training-in-bangalore
Spring-training-in-bangalore
ย 
What's new in jQuery 1.5
What's new in jQuery 1.5What's new in jQuery 1.5
What's new in jQuery 1.5
ย 
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code ExampleMaven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
ย 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
ย 
Testing microservices: Tools and Frameworks
Testing microservices: Tools and FrameworksTesting microservices: Tools and Frameworks
Testing microservices: Tools and Frameworks
ย 
lecture5
lecture5lecture5
lecture5
ย 

More from Matthew McCullough

iPhone & Java Web Services, Take 2
iPhone & Java Web Services, Take 2iPhone & Java Web Services, Take 2
iPhone & Java Web Services, Take 2Matthew McCullough
ย 
iPhone & Java Web Services
iPhone & Java Web ServicesiPhone & Java Web Services
iPhone & Java Web ServicesMatthew McCullough
ย 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSMatthew McCullough
ย 
Terracotta Java Scalability - Stateless Versus Stateful Apps
Terracotta Java Scalability - Stateless Versus Stateful AppsTerracotta Java Scalability - Stateless Versus Stateful Apps
Terracotta Java Scalability - Stateless Versus Stateful AppsMatthew McCullough
ย 
DOSUG GridGain Java Grid Computing Made Simple
DOSUG GridGain Java Grid Computing Made SimpleDOSUG GridGain Java Grid Computing Made Simple
DOSUG GridGain Java Grid Computing Made SimpleMatthew McCullough
ย 
DOSUG Intro to JQuery JavaScript Framework
DOSUG Intro to JQuery JavaScript FrameworkDOSUG Intro to JQuery JavaScript Framework
DOSUG Intro to JQuery JavaScript FrameworkMatthew McCullough
ย 
DOSUG Java FX Script From Takeoff To Cruising Altitude
DOSUG Java FX Script From Takeoff To Cruising AltitudeDOSUG Java FX Script From Takeoff To Cruising Altitude
DOSUG Java FX Script From Takeoff To Cruising AltitudeMatthew McCullough
ย 
DOSUG XML Beans overview by Om Sivanesian
DOSUG XML Beans overview by Om SivanesianDOSUG XML Beans overview by Om Sivanesian
DOSUG XML Beans overview by Om SivanesianMatthew McCullough
ย 
DOSUG Tech Overview of XAware
DOSUG Tech Overview of XAwareDOSUG Tech Overview of XAware
DOSUG Tech Overview of XAwareMatthew McCullough
ย 

More from Matthew McCullough (11)

iPhone & Java Web Services, Take 2
iPhone & Java Web Services, Take 2iPhone & Java Web Services, Take 2
iPhone & Java Web Services, Take 2
ย 
iPhone & Java Web Services
iPhone & Java Web ServicesiPhone & Java Web Services
iPhone & Java Web Services
ย 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCS
ย 
Terracotta Java Scalability - Stateless Versus Stateful Apps
Terracotta Java Scalability - Stateless Versus Stateful AppsTerracotta Java Scalability - Stateless Versus Stateful Apps
Terracotta Java Scalability - Stateless Versus Stateful Apps
ย 
DOSUG GridGain Java Grid Computing Made Simple
DOSUG GridGain Java Grid Computing Made SimpleDOSUG GridGain Java Grid Computing Made Simple
DOSUG GridGain Java Grid Computing Made Simple
ย 
DOSUG Intro to JQuery JavaScript Framework
DOSUG Intro to JQuery JavaScript FrameworkDOSUG Intro to JQuery JavaScript Framework
DOSUG Intro to JQuery JavaScript Framework
ย 
DOSUG Wicket 101
DOSUG Wicket 101DOSUG Wicket 101
DOSUG Wicket 101
ย 
EasyMock 101
EasyMock 101EasyMock 101
EasyMock 101
ย 
DOSUG Java FX Script From Takeoff To Cruising Altitude
DOSUG Java FX Script From Takeoff To Cruising AltitudeDOSUG Java FX Script From Takeoff To Cruising Altitude
DOSUG Java FX Script From Takeoff To Cruising Altitude
ย 
DOSUG XML Beans overview by Om Sivanesian
DOSUG XML Beans overview by Om SivanesianDOSUG XML Beans overview by Om Sivanesian
DOSUG XML Beans overview by Om Sivanesian
ย 
DOSUG Tech Overview of XAware
DOSUG Tech Overview of XAwareDOSUG Tech Overview of XAware
DOSUG Tech Overview of XAware
ย 

Recently uploaded

Business Principles, Tools, and Techniques in Participating in Various Types...
Business Principles, Tools, and Techniques  in Participating in Various Types...Business Principles, Tools, and Techniques  in Participating in Various Types...
Business Principles, Tools, and Techniques in Participating in Various Types...jeffreytingson
ย 
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbaiVasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbaipriyasharma62062
ย 
VIP Independent Call Girls in Andheri ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts...VIP Independent Call Girls in Andheri ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts...dipikadinghjn ( Why You Choose Us? ) Escorts
ย 
โžฅ๐Ÿ” 7737669865 ๐Ÿ”โ–ป Malda Call-girls in Women Seeking Men ๐Ÿ”Malda๐Ÿ” Escorts Ser...
โžฅ๐Ÿ” 7737669865 ๐Ÿ”โ–ป Malda Call-girls in Women Seeking Men  ๐Ÿ”Malda๐Ÿ”   Escorts Ser...โžฅ๐Ÿ” 7737669865 ๐Ÿ”โ–ป Malda Call-girls in Women Seeking Men  ๐Ÿ”Malda๐Ÿ”   Escorts Ser...
โžฅ๐Ÿ” 7737669865 ๐Ÿ”โ–ป Malda Call-girls in Women Seeking Men ๐Ÿ”Malda๐Ÿ” Escorts Ser...amitlee9823
ย 
Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...
Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...
Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...priyasharma62062
ย 
VIP Independent Call Girls in Mumbai ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Mumbai ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...VIP Independent Call Girls in Mumbai ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Mumbai ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...dipikadinghjn ( Why You Choose Us? ) Escorts
ย 
( Jasmin ) Top VIP Escorts Service Dindigul ๐Ÿ’ง 7737669865 ๐Ÿ’ง by Dindigul Call G...
( Jasmin ) Top VIP Escorts Service Dindigul ๐Ÿ’ง 7737669865 ๐Ÿ’ง by Dindigul Call G...( Jasmin ) Top VIP Escorts Service Dindigul ๐Ÿ’ง 7737669865 ๐Ÿ’ง by Dindigul Call G...
( Jasmin ) Top VIP Escorts Service Dindigul ๐Ÿ’ง 7737669865 ๐Ÿ’ง by Dindigul Call G...dipikadinghjn ( Why You Choose Us? ) Escorts
ย 
Technology industry / Finnish economic outlook
Technology industry / Finnish economic outlookTechnology industry / Finnish economic outlook
Technology industry / Finnish economic outlookTechFinland
ย 
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Availabledollysharma2066
ย 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
ย 
VIP Call Girl in Mumbai ๐Ÿ’ง 9920725232 ( Call Me ) Get A New Crush Everyday Wit...
VIP Call Girl in Mumbai ๐Ÿ’ง 9920725232 ( Call Me ) Get A New Crush Everyday Wit...VIP Call Girl in Mumbai ๐Ÿ’ง 9920725232 ( Call Me ) Get A New Crush Everyday Wit...
VIP Call Girl in Mumbai ๐Ÿ’ง 9920725232 ( Call Me ) Get A New Crush Everyday Wit...dipikadinghjn ( Why You Choose Us? ) Escorts
ย 
CBD Belapur Expensive Housewife Call Girls Number-๐Ÿ“ž๐Ÿ“ž9833754194 No 1 Vipp HIgh...
CBD Belapur Expensive Housewife Call Girls Number-๐Ÿ“ž๐Ÿ“ž9833754194 No 1 Vipp HIgh...CBD Belapur Expensive Housewife Call Girls Number-๐Ÿ“ž๐Ÿ“ž9833754194 No 1 Vipp HIgh...
CBD Belapur Expensive Housewife Call Girls Number-๐Ÿ“ž๐Ÿ“ž9833754194 No 1 Vipp HIgh...priyasharma62062
ย 
Lion One Corporate Presentation May 2024
Lion One Corporate Presentation May 2024Lion One Corporate Presentation May 2024
Lion One Corporate Presentation May 2024Adnet Communications
ย 
VIP Kalyan Call Girls ๐ŸŒ 9920725232 ๐ŸŒ Make Your Dreams Come True With Mumbai E...
VIP Kalyan Call Girls ๐ŸŒ 9920725232 ๐ŸŒ Make Your Dreams Come True With Mumbai E...VIP Kalyan Call Girls ๐ŸŒ 9920725232 ๐ŸŒ Make Your Dreams Come True With Mumbai E...
VIP Kalyan Call Girls ๐ŸŒ 9920725232 ๐ŸŒ Make Your Dreams Come True With Mumbai E...roshnidevijkn ( Why You Choose Us? ) Escorts
ย 
Cybersecurity Threats in Financial Services Protection.pptx
Cybersecurity Threats in  Financial Services Protection.pptxCybersecurity Threats in  Financial Services Protection.pptx
Cybersecurity Threats in Financial Services Protection.pptxLumiverse Solutions Pvt Ltd
ย 
7 tips trading Deriv Accumulator Options
7 tips trading Deriv Accumulator Options7 tips trading Deriv Accumulator Options
7 tips trading Deriv Accumulator OptionsVince Stanzione
ย 
(Sexy Sheela) Call Girl Mumbai Call Now ๐Ÿ‘‰9920725232๐Ÿ‘ˆ Mumbai Escorts 24x7
(Sexy Sheela) Call Girl Mumbai Call Now ๐Ÿ‘‰9920725232๐Ÿ‘ˆ Mumbai Escorts 24x7(Sexy Sheela) Call Girl Mumbai Call Now ๐Ÿ‘‰9920725232๐Ÿ‘ˆ Mumbai Escorts 24x7
(Sexy Sheela) Call Girl Mumbai Call Now ๐Ÿ‘‰9920725232๐Ÿ‘ˆ Mumbai Escorts 24x7jayawati511
ย 
VIP Independent Call Girls in Taloja ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Taloja ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...VIP Independent Call Girls in Taloja ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Taloja ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...dipikadinghjn ( Why You Choose Us? ) Escorts
ย 

Recently uploaded (20)

Business Principles, Tools, and Techniques in Participating in Various Types...
Business Principles, Tools, and Techniques  in Participating in Various Types...Business Principles, Tools, and Techniques  in Participating in Various Types...
Business Principles, Tools, and Techniques in Participating in Various Types...
ย 
Call Girls in New Ashok Nagar, (delhi) call me [9953056974] escort service 24X7
Call Girls in New Ashok Nagar, (delhi) call me [9953056974] escort service 24X7Call Girls in New Ashok Nagar, (delhi) call me [9953056974] escort service 24X7
Call Girls in New Ashok Nagar, (delhi) call me [9953056974] escort service 24X7
ย 
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbaiVasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
ย 
VIP Independent Call Girls in Andheri ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts...VIP Independent Call Girls in Andheri ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts...
ย 
โžฅ๐Ÿ” 7737669865 ๐Ÿ”โ–ป Malda Call-girls in Women Seeking Men ๐Ÿ”Malda๐Ÿ” Escorts Ser...
โžฅ๐Ÿ” 7737669865 ๐Ÿ”โ–ป Malda Call-girls in Women Seeking Men  ๐Ÿ”Malda๐Ÿ”   Escorts Ser...โžฅ๐Ÿ” 7737669865 ๐Ÿ”โ–ป Malda Call-girls in Women Seeking Men  ๐Ÿ”Malda๐Ÿ”   Escorts Ser...
โžฅ๐Ÿ” 7737669865 ๐Ÿ”โ–ป Malda Call-girls in Women Seeking Men ๐Ÿ”Malda๐Ÿ” Escorts Ser...
ย 
Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...
Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...
Kopar Khairane Russian Call Girls Number-9833754194-Navi Mumbai Fantastic Unl...
ย 
VIP Independent Call Girls in Mumbai ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Mumbai ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...VIP Independent Call Girls in Mumbai ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Mumbai ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
ย 
( Jasmin ) Top VIP Escorts Service Dindigul ๐Ÿ’ง 7737669865 ๐Ÿ’ง by Dindigul Call G...
( Jasmin ) Top VIP Escorts Service Dindigul ๐Ÿ’ง 7737669865 ๐Ÿ’ง by Dindigul Call G...( Jasmin ) Top VIP Escorts Service Dindigul ๐Ÿ’ง 7737669865 ๐Ÿ’ง by Dindigul Call G...
( Jasmin ) Top VIP Escorts Service Dindigul ๐Ÿ’ง 7737669865 ๐Ÿ’ง by Dindigul Call G...
ย 
Technology industry / Finnish economic outlook
Technology industry / Finnish economic outlookTechnology industry / Finnish economic outlook
Technology industry / Finnish economic outlook
ย 
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
ย 
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
ย 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
ย 
VIP Call Girl in Mumbai ๐Ÿ’ง 9920725232 ( Call Me ) Get A New Crush Everyday Wit...
VIP Call Girl in Mumbai ๐Ÿ’ง 9920725232 ( Call Me ) Get A New Crush Everyday Wit...VIP Call Girl in Mumbai ๐Ÿ’ง 9920725232 ( Call Me ) Get A New Crush Everyday Wit...
VIP Call Girl in Mumbai ๐Ÿ’ง 9920725232 ( Call Me ) Get A New Crush Everyday Wit...
ย 
CBD Belapur Expensive Housewife Call Girls Number-๐Ÿ“ž๐Ÿ“ž9833754194 No 1 Vipp HIgh...
CBD Belapur Expensive Housewife Call Girls Number-๐Ÿ“ž๐Ÿ“ž9833754194 No 1 Vipp HIgh...CBD Belapur Expensive Housewife Call Girls Number-๐Ÿ“ž๐Ÿ“ž9833754194 No 1 Vipp HIgh...
CBD Belapur Expensive Housewife Call Girls Number-๐Ÿ“ž๐Ÿ“ž9833754194 No 1 Vipp HIgh...
ย 
Lion One Corporate Presentation May 2024
Lion One Corporate Presentation May 2024Lion One Corporate Presentation May 2024
Lion One Corporate Presentation May 2024
ย 
VIP Kalyan Call Girls ๐ŸŒ 9920725232 ๐ŸŒ Make Your Dreams Come True With Mumbai E...
VIP Kalyan Call Girls ๐ŸŒ 9920725232 ๐ŸŒ Make Your Dreams Come True With Mumbai E...VIP Kalyan Call Girls ๐ŸŒ 9920725232 ๐ŸŒ Make Your Dreams Come True With Mumbai E...
VIP Kalyan Call Girls ๐ŸŒ 9920725232 ๐ŸŒ Make Your Dreams Come True With Mumbai E...
ย 
Cybersecurity Threats in Financial Services Protection.pptx
Cybersecurity Threats in  Financial Services Protection.pptxCybersecurity Threats in  Financial Services Protection.pptx
Cybersecurity Threats in Financial Services Protection.pptx
ย 
7 tips trading Deriv Accumulator Options
7 tips trading Deriv Accumulator Options7 tips trading Deriv Accumulator Options
7 tips trading Deriv Accumulator Options
ย 
(Sexy Sheela) Call Girl Mumbai Call Now ๐Ÿ‘‰9920725232๐Ÿ‘ˆ Mumbai Escorts 24x7
(Sexy Sheela) Call Girl Mumbai Call Now ๐Ÿ‘‰9920725232๐Ÿ‘ˆ Mumbai Escorts 24x7(Sexy Sheela) Call Girl Mumbai Call Now ๐Ÿ‘‰9920725232๐Ÿ‘ˆ Mumbai Escorts 24x7
(Sexy Sheela) Call Girl Mumbai Call Now ๐Ÿ‘‰9920725232๐Ÿ‘ˆ Mumbai Escorts 24x7
ย 
VIP Independent Call Girls in Taloja ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Taloja ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...VIP Independent Call Girls in Taloja ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Taloja ๐ŸŒน 9920725232 ( Call Me ) Mumbai Escorts ...
ย 

DOSUG Taking Apache Camel For A Ride

  • 1. Taking Apache Camel For a Ride Bruce Snyder bsnyder@apache.org 3 June 2008 1
  • 5. Apache Camel http://activemq.apache.org/camel/ 5
  • 7. Enterprise Integration Patterns http://enterpriseintegrationpatterns.com/ 7
  • 10. Language Support โ€ข BeanShell โ€ข SQL โ€ข Javascript โ€ข XPath โ€ข Groovy โ€ข XQuery โ€ข Python โ€ข OGNL โ€ข PHP โ€ข JSR 223 scripting โ€ข Ruby 10
  • 11. Apache Camel Components http://activemq.apache.org/camel/components.html 11
  • 12. History of Apache Camel 12
  • 13. The Camel Context CamelContext context = new DefaultCamelContext(); context.addRoutes(new MyRouteBuilder()); context.start(); <camelContext xmlns=quot;http://activemq.apache.org/camel/schema/springquot;> <package>com.acme.quotes</package> </camelContext> 13
  • 16. 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;); } }; 16
  • 17. Content Based Router <camelContext xmlns=quot;http://activemq.apache.org/camel/schema/springquot;> <route> <from uri=quot;activemq:NewOrdersquot;/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri=quot;activemq:Orders.Widgetsquot;/> </when> <when> <xpath>/order/product = 'gadget'</xpath> <to uri=quot;activemq:Orders.Gadgetsquot;/> </when> <otherwise> <to uri=quot;activemq:Orders.Badquot;/> </otherwise> </choice> </route> </camelContext> 17
  • 18. Message Filter public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;activemq:topic:Quotes). filter().xpath(quot;/quote/product = โ€˜widgetโ€™quot;). to(quot;mqseries:WidgetQuotesquot;); } } 18
  • 19. Message Filter <camelContext xmlns=quot;http://activemq.apache.org/camel/schema/springquot;> <route> <from uri=quot;activemq:topic:Quotesquot;/> <filter> <xpath>/quote/product = โ€˜widgetโ€™</xpath> <to uri=quot;mqseries:WidgetQuotesquot;/> </filter> </route> </camelContext> 19
  • 20. Splitter public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;file://ordersquot;). splitter(body().tokenize(quot;nquot;)). to(quot;activemq:Order.Itemsquot;); } } 20
  • 21. Splitter Using XQuery public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;file://ordersquot;). splitter().xquery(quot;/order/itemsquot;). to(quot;activemq:Order.Itemsquot;); } } 21
  • 22. Aggregator public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;activemq:Inventory.Itemsquot;). aggregator().xpath(quot;/order/@idquot;). to(quot;activemq:Inventory.Orderquot;); } } 22
  • 23. Message Translator public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;file://incomingโ€). to(quot;xslt:com/acme/mytransform.xslquot;). to(quot;http://outgoing.com/fooquot;); } } 23
  • 24. Resequencer public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;direct:aโ€). resequencer(header(quot;JMSPriorityquot;)). to(quot;seda:bquot;); } } 24
  • 25. Throttler public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;seda:aโ€). throttler(3).timePeriodMillis(30000). to(quot;seda:bquot;); } } 25
  • 26. Delayer public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;seda:aโ€). delayer(header(quot;JMSTimestampquot;, 3000). to(quot;seda:bquot;); } } 26
  • 27. Combine Patterns public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;seda:aโ€). resequencer(header(quot;JMSPriorityquot;)). delayer(3000). to(quot;seda:bquot;); } } 27
  • 28. Beans 28
  • 29. Bean package com.mycompany.beans; public class MyBean { public void someMethod(String name) { ... } } <camelContext xmlns=quot;http://activemq.apache.org/camel/schema/springquot;> <package>com.mycompany.beans</package> </camelContext> 29
  • 30. Bean as a Message Translator public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;activemq:Incomingโ€). beanRef(quot;myBeanquot;). to(quot;activemq:Outgoingquot;); } } 30
  • 31. Bean as a Message Translator *With Method Name public class MyRouteBuilder extends RouteBuilder { public void configure() { from(quot;activemq:Incomingโ€). beanRef(quot;myBeanquot;, quot;someMethodquot;). to(quot;activemq:Outgoingquot;); } } 31
  • 33. Type Conversion @Converter public class IOConverter { @Converter public static InputStream toInputStream(File file) throws FileNotFoundException { return new BufferedInputStream( new FileInputStream(file)); } } 33
  • 34. Binding Beans to Camel Endpoints public class Foo { @MessageDriven(uri=quot;activemq:cheesequot;) public void onCheese(String name) { ... } } 34
  • 35. Binding Method Arguments public class Foo { public void onCheese( @XPath(quot;/foo/barquot;) String name, @Header(quot;JMSCorrelationIDquot;) String id) { ... } } http://activemq.apache.org/camel/bean-integration.html 35
  • 36. Injecting Endpoints Into Beans public class Foo { @EndpointInject(uri=quot;activemq:foo.barquot;) ProducerTemplate producer; public void doSomething() { if (whatever) { producer.sendBody(quot;<hello>world!</hello>quot;); } } } 36
  • 37. Spring Remoting - Server Side <camelContext xmlns=quot;http://activemq.apache.org/camel/schema/springquot;> <export id=quot;sayServicequot; uri=quot;activemq:MyServicequot; serviceRef=quot;sayImplquot; serviceInterface=quot;com.acme.MyServiceInterfacequot;/> </camelContext> <bean id=quot;sayImplquot; class=quot;com.acme.MyServiceImplquot;/> 37
  • 38. Spring Remoting - Client Side <camelContext xmlns=quot;http://activemq.apache.org/camel/schema/springquot;> <proxy id=quot;sayServicequot; serviceUrl=quot;activemq:MyServicequot; serviceInterface=quot;com.acme.MyServiceInterfacequot;/> </camelContext> 38
  • 39. Dependency Injection <camelContext xmlns=quot;http://activemq.apache.org/camel/schema/springquot;> ... </camelContext> <bean id=quot;activemqquot; class=quot;org.apache.camel.component.jms.JmsComponentquot;> <property name=quot;connectionFactoryquot;> <bean class=quot;org.apache.activemq.ActiveMQConnectionFactoryquot;> <property name=quot;brokerURLquot; value=quot;vm://localhost?broker.persistent=falsequot;/> </bean> </property> </bean> 39
  • 41. Business Activity Monitoring (BAM) public class MyActivities extends ProcessBuilder { public void configure() throws Exception { // lets define some activities, correlating on an // XPath query of the message body ActivityBuilder purchaseOrder = activity(quot;activemq:PurchaseOrdersquot;) .correlate(xpath(quot;/purchaseOrder/@idquot;).stringResult()); ActivityBuilder invoice = activity(quot;activemq:Invoicesquot;) .correlate(xpath(quot;/invoice/@purchaseOrderIdquot;).stringResult()); // now lets add some BAM rules invoice.starts().after(purchaseOrder.completes()) .expectWithin(seconds(1)) .errorIfOver(seconds(2)).to(quot;activemq:FailedProcessesquot;); } } 41