SlideShare una empresa de Scribd logo
1 de 59
Descargar para leer sin conexión
Easy Enterprise Integration Patterns
                  with Apache Camel,
               ActiveMQ and ServiceMix




                           James Strachan
                   http://macstrac.blogspot.com/




http://open.iona.com/
What are Enterprise Integration Patterns?
Book by Gregor & Bobby!
A selection of some of the patterns...
What is Camel?
Why?
Aims of Camel

    to make integration as simple as it can possibly be
What is Camel?
           http://activemq.apache.org/camel/
What is Camel?




Spring based Enterprise Integration Patterns

http://activemq.apache.org/camel/enterprise-integration-patterns.html
A selection of some of the patterns...
Lets look at a pattern!
Message Filter
Message Filter : XML


   <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
     <route>
       <from uri="activemq:topic:Quotes"/>
       <filter>
         <xpath>/quote/product = ‘widget’</xpath>
         <to uri="mqseries:WidgetQuotes"/>
       </filter>
     </route>
   </camelContext>
Message Filter : Spring XML

 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://activemq.apache.org/camel/schema/spring
        http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
     <route>
       <from uri="activemq:topic:Quotes"/>
       <filter>
         <xpath>/quote/product = ‘widget’</xpath>
         <to uri="mqseries:WidgetQuotes"/>
       </filter>
     </route>
   </camelContext>

 </beans>
Message Filter : XML


   <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
     <route>
       <from uri="activemq:topic:Quotes"/>
       <filter>
         <xpath>/quote/product = ‘widget’</xpath>
         <to uri="mqseries:WidgetQuotes"/>
       </filter>
     </route>
   </camelContext>
Expressions & Predicates


             BeanShell      PHP
                 EL        Python
               Groovy      Ruby
             JavaScript     SQL
              JSR 223      XPath
               OGNL        XQuery
URIs, Endpoints and Components

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

   activemq        ibatis     mail           rmi            udp

activemq.journal   imap       mina           rnc          validation

     bean           irc      mock            rng           velocity

      cxf          jdbc       msv            seda            vm

     direct        jetty    multicast        sftp          xmpp

     event          jbi       pojo          smtp           xquery

      file          jms        pop       string-template      xslt

      ftp           jpa      quartz          timer        webdav

      http          log      queue           tcp
Message Filter : XML


   <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
     <route>
       <from uri="activemq:topic:Quotes"/>
       <filter>
         <xpath>/quote/product = ‘widget’</xpath>
         <to uri="mqseries:WidgetQuotes"/>
       </filter>
     </route>
   </camelContext>
Message Filter : Java




from("activemq:topic:Quotes).
  filter().xpath("/quote/product = ‘widget’").
    to("mqseries:WidgetQuotes");
Message Filter : Java Complete

package com.acme.quotes;

import org.apache.camel.builder.RouteBuilder;

public class MyRouteBuilder extends RouteBuilder {

        public void configure() {

           // forward widget quotes to MQSeries
           from("activemq:topic:Quotes).
                   filter().xpath("/quote/product = ‘widget’").
                   to("mqseries:WidgetQuotes");
    }
}
Create CamelContext in Java




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




<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
  <package>com.acme.quotes</package>
</camelContext>
More Patterns!
Content Based Router
Content Based Router

  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
    <route>
      <from uri="activemq:NewOrders"/>
      <choice>
        <when>
          <xpath>/order/product = 'widget'</xpath>
          <to uri="activemq:Orders.Widgets"/>
        </when>
        <when>
          <xpath>/order/product = 'gadget'</xpath>
          <to uri="activemq:Orders.Gadgets"/>
        </when>
        <otherwise>
          <to uri="activemq:Orders.Bad"/>
        </otherwise>
      </choice>
    </route>
  </camelContext>
Splitter
Splitter



     from("file://orders").
       splitter(body().tokenize("n")).
         to("activemq:Order.Items");
Splitter using XQuery



   from("file://orders").
     splitter().xquery("/order/items").
       to("activemq:Order.Items");
Aggregator
Aggregator




    from("activemq:Inventory.Items").
      aggregator().xpath("/order/@id").
      to("activemq:Inventory.Order");
Message Translator
Message Translator




from("file://incoming”).
  to("xslt:com/acme/mytransform.xsl").
    to("http://outgoing.com/foo");
Quick recap
Beans
Bean as a Message Translator




from("activemq:Incoming”).
  beanRef("myBeanName").
    to("activemq:Outgoing");
Bean




public class Foo {

    public void someMethod(String name) {
      ...
    }
}
Bean as a Message Translator with method name




from("activemq:Incoming”).
  beanRef("myBeanName", "someMethod").
    to("activemq:Outgoing");
Type Conversion
Type Conversion

package com.acme.foo.converters;

import org.apache.camel.Converter;
import java.io.*;

@Converter
public class IOConverter {

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




# META-INF/services/org/apache/camel/TypeConverter

com.acme.foo.converters
Binding Beans to Camel Endpoints



 public class Foo {

     @MessageDriven(uri="activemq:cheese")
     public void onCheese(String name) {
       ...
     }
 }
Binding Method Arguments


 public class Foo {

     public void onCheese(
       @XPath("/foo/bar") String name,
       @Header("JMSCorrelationID") String id) {
       ...
     }
 }

                     for more annotations see
     http://activemq.apache.org/camel/bean-integration.html
Injecting endpoints into beans


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

    public void doSomething() {
      if (whatever) {
        producer.sendBody("<hello>world!</hello>");
      }
    }
}
Spring Remoting - Client Side




 <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
   <proxy id="sayService" serviceUrl="activemq:MyService"
     serviceInterface="com.acme.MyServiceInterface"/>
 </camelContext>
Spring Remoting - Server Side



 <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
   <export id="sayService" uri="activemq:MyService" serviceRef="sayImpl"
     serviceInterface="com.acme.MyServiceInterface"/>
 </camelContext>

 <bean id="sayImpl" class="com.acme.MyServiceImpl"/>
Dependency Injection

<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
  ...
</camelContext>

<bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
  <property name="connectionFactory">
    <bean class="org.apache.activemq.ActiveMQConnectionFactory">
      <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
    </bean>
  </property>
</bean>
Data Format




from("activemq:QueueWithJavaObjects).
  marshal().jaxb().
    to("mqseries:QueueWithXmlMessages");
Business Activity Monitoring (BAM)
Business Activity Monitoring (BAM)

public class MyActivities extends ProcessBuilder {

     public void configure() throws Exception {

         // lets define some activities, correlating on an XPath on the message bodies
         ActivityBuilder purchaseOrder = activity("activemq:PurchaseOrders")
                 .correlate(xpath("/purchaseOrder/@id").stringResult());

         ActivityBuilder invoice = activity("activemq:Invoices")
                 .correlate(xpath("/invoice/@purchaseOrderId").stringResult());

         // now lets add some BAM rules
         invoice.starts().after(purchaseOrder.completes())
                 .expectWithin(seconds(1))
                 .errorIfOver(seconds(2)).to("activemq:FailedProcesses");
     }
}
Riding the camel
Where would I use Camel?

•standalone or in any Spring application

•inside ActiveMQ’s JMS client or the broker

•inside your ESB such as ServiceMix via the
 servicemix-camel Service Unit

•inside CXF either as a transport or reusing
 CXF inside Camel
Camel Riding from Java




•/META-INF/spring/camelContext.xml
•set the CLASSPATH
•java org.apache.camel.spring.Main
Maven Tooling
 <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>




 mvn camel:run
Maven Plugin Site Report
Where do I get more info?
                please do take Camel for a ride!


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

                    don’t get the hump! :-)
Questions?
James Strachan




                             blog


                 http://macstrac.blogspot.com/
Camel v Mule




• A Camel can carry 4 times as much load as other beasts of burden!


 http://activemq.apache.org/camel/why-the-name-camel.html
Camel v Mule

•Camel provides a higher level abstraction for
 EIP; making it simpler & easier & less XML

•Awesome integration with JMS + ActiveMQ
 (client and broker), JBI + ServiceMix and
 JAX-WS + CXF

•great testing with Camel’s Mock Endpoint

•Business Activity Monitoring framework
Where do I get more info?
                please do take Camel for a ride!


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

                    don’t get the hump! :-)

Más contenido relacionado

La actualidad más candente

Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache CamelRosen Spasov
 
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
 
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
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and GroovyClaus Ibsen
 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - CopenhagenClaus Ibsen
 
Using Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityUsing Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityClaus Ibsen
 
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
 
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
 
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
 
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
 
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
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play appsYevgeniy Brikman
 
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
 
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
 

La actualidad más candente (20)

Integration made easy with Apache Camel
Integration made easy with Apache CamelIntegration made easy with Apache Camel
Integration made easy with Apache Camel
 
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
 
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
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - Copenhagen
 
Using Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivityUsing Apache Camel connectors for external connectivity
Using Apache Camel connectors for external connectivity
 
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
 
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
 
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
 
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
 
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
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play apps
 
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
 
Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
 
Rails Performance
Rails PerformanceRails Performance
Rails Performance
 
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
 

Destacado

Smart Enterprise Application Integration with Apache Camel
Smart Enterprise Application Integration with Apache Camel Smart Enterprise Application Integration with Apache Camel
Smart Enterprise Application Integration with Apache Camel Kai Wähner
 
Scandev / SDC2013 - Spoilt for Choice: Which Integration Framework to use – A...
Scandev / SDC2013 - Spoilt for Choice: Which Integration Framework to use – A...Scandev / SDC2013 - Spoilt for Choice: Which Integration Framework to use – A...
Scandev / SDC2013 - Spoilt for Choice: Which Integration Framework to use – A...Kai Wähner
 
Employing Enterprise Application Integration (EAI)
Employing Enterprise Application Integration (EAI)Employing Enterprise Application Integration (EAI)
Employing Enterprise Application Integration (EAI)elliando dias
 
Enterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelEnterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelIoan Eugen Stan
 
TS 4839 - Enterprise Integration Patterns in Practice
TS 4839 - Enterprise Integration Patterns in PracticeTS 4839 - Enterprise Integration Patterns in Practice
TS 4839 - Enterprise Integration Patterns in Practiceaegloff
 
Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success WSO2
 
Enterprise Integration Patterns Revisited (EIP) for the Era of Big Data, Inte...
Enterprise Integration Patterns Revisited (EIP) for the Era of Big Data, Inte...Enterprise Integration Patterns Revisited (EIP) for the Era of Big Data, Inte...
Enterprise Integration Patterns Revisited (EIP) for the Era of Big Data, Inte...Kai Wähner
 
Enterprise Integration Patterns
Enterprise Integration PatternsEnterprise Integration Patterns
Enterprise Integration PatternsSergey Podolsky
 
Topic3 Enterprise Application Integration
Topic3 Enterprise Application IntegrationTopic3 Enterprise Application Integration
Topic3 Enterprise Application Integrationsanjoysanyal
 
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...Kai Wähner
 
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...Kai Wähner
 
Dynamic AX : Application Integration Framework
Dynamic AX : Application Integration FrameworkDynamic AX : Application Integration Framework
Dynamic AX : Application Integration FrameworkSaboor Ahmed
 
Enterprise Integration Patterns Revisited (EIP, Apache Camel, Talend ESB)
Enterprise Integration Patterns Revisited (EIP, Apache Camel, Talend ESB)Enterprise Integration Patterns Revisited (EIP, Apache Camel, Talend ESB)
Enterprise Integration Patterns Revisited (EIP, Apache Camel, Talend ESB)Kai Wähner
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesIntegration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesApcera
 
How to choose the right Integration Framework - Apache Camel (JBoss, Talend),...
How to choose the right Integration Framework - Apache Camel (JBoss, Talend),...How to choose the right Integration Framework - Apache Camel (JBoss, Talend),...
How to choose the right Integration Framework - Apache Camel (JBoss, Talend),...Kai Wähner
 
Modern Enterprise integration Strategies
Modern Enterprise integration StrategiesModern Enterprise integration Strategies
Modern Enterprise integration StrategiesJesus Rodriguez
 

Destacado (17)

Smart Enterprise Application Integration with Apache Camel
Smart Enterprise Application Integration with Apache Camel Smart Enterprise Application Integration with Apache Camel
Smart Enterprise Application Integration with Apache Camel
 
Scandev / SDC2013 - Spoilt for Choice: Which Integration Framework to use – A...
Scandev / SDC2013 - Spoilt for Choice: Which Integration Framework to use – A...Scandev / SDC2013 - Spoilt for Choice: Which Integration Framework to use – A...
Scandev / SDC2013 - Spoilt for Choice: Which Integration Framework to use – A...
 
Employing Enterprise Application Integration (EAI)
Employing Enterprise Application Integration (EAI)Employing Enterprise Application Integration (EAI)
Employing Enterprise Application Integration (EAI)
 
Enterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache CamelEnterprise Integration Patterns with Apache Camel
Enterprise Integration Patterns with Apache Camel
 
TS 4839 - Enterprise Integration Patterns in Practice
TS 4839 - Enterprise Integration Patterns in PracticeTS 4839 - Enterprise Integration Patterns in Practice
TS 4839 - Enterprise Integration Patterns in Practice
 
Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success
 
Enterprise Integration Patterns Revisited (EIP) for the Era of Big Data, Inte...
Enterprise Integration Patterns Revisited (EIP) for the Era of Big Data, Inte...Enterprise Integration Patterns Revisited (EIP) for the Era of Big Data, Inte...
Enterprise Integration Patterns Revisited (EIP) for the Era of Big Data, Inte...
 
Enterprise Integration Patterns
Enterprise Integration PatternsEnterprise Integration Patterns
Enterprise Integration Patterns
 
Topic3 Enterprise Application Integration
Topic3 Enterprise Application IntegrationTopic3 Enterprise Application Integration
Topic3 Enterprise Application Integration
 
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...
 
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
Showdown: Integration Framework (Spring Integration, Apache Camel) vs. Enterp...
 
Dynamic AX : Application Integration Framework
Dynamic AX : Application Integration FrameworkDynamic AX : Application Integration Framework
Dynamic AX : Application Integration Framework
 
Enterprise Integration Patterns Revisited (EIP, Apache Camel, Talend ESB)
Enterprise Integration Patterns Revisited (EIP, Apache Camel, Talend ESB)Enterprise Integration Patterns Revisited (EIP, Apache Camel, Talend ESB)
Enterprise Integration Patterns Revisited (EIP, Apache Camel, Talend ESB)
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices ArchitecturesIntegration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices Architectures
 
How to choose the right Integration Framework - Apache Camel (JBoss, Talend),...
How to choose the right Integration Framework - Apache Camel (JBoss, Talend),...How to choose the right Integration Framework - Apache Camel (JBoss, Talend),...
How to choose the right Integration Framework - Apache Camel (JBoss, Talend),...
 
Enterprise Integration Patterns
Enterprise Integration PatternsEnterprise Integration Patterns
Enterprise Integration Patterns
 
Modern Enterprise integration Strategies
Modern Enterprise integration StrategiesModern Enterprise integration Strategies
Modern Enterprise integration Strategies
 

Similar a Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix

Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortalJennifer Bourey
 
Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a RideBruce Snyder
 
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)DK Lee
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsFrancois Zaninotto
 
Enterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQEnterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQelliando dias
 
Primefaces Confess 2012
Primefaces Confess 2012Primefaces Confess 2012
Primefaces Confess 2012cagataycivici
 
RESTful Web Applications with Apache Sling
RESTful Web Applications with Apache SlingRESTful Web Applications with Apache Sling
RESTful Web Applications with Apache SlingBertrand Delacretaz
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen LjuSkills Matter
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen LjuSkills Matter
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBob Paulin
 
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
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for JoomlaLuke Summerfield
 

Similar a Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix (20)

Riding Apache Camel
Riding Apache CamelRiding Apache Camel
Riding Apache Camel
 
Aimaf
AimafAimaf
Aimaf
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a Ride
 
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Spine.js
Spine.jsSpine.js
Spine.js
 
Camel as a_glue
Camel as a_glueCamel as a_glue
Camel as a_glue
 
Enterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQEnterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQ
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
Soap Component
Soap ComponentSoap Component
Soap Component
 
Primefaces Confess 2012
Primefaces Confess 2012Primefaces Confess 2012
Primefaces Confess 2012
 
How to use soap component
How to use soap componentHow to use soap component
How to use soap component
 
RESTful Web Applications with Apache Sling
RESTful Web Applications with Apache SlingRESTful Web Applications with Apache Sling
RESTful Web Applications with Apache Sling
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen Lju
 
Primefaces Nextgen Lju
Primefaces Nextgen LjuPrimefaces Nextgen Lju
Primefaces Nextgen Lju
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
 
Serverless Java on Kubernetes
Serverless Java on KubernetesServerless Java on Kubernetes
Serverless Java on Kubernetes
 
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
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 

Más de elliando dias

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slideselliando dias
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScriptelliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structureselliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de containerelliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Librarieselliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Webelliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduinoelliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorceryelliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Designelliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makeselliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebookelliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Studyelliando dias
 

Más de elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 

Último

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Último (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix

  • 1. Easy Enterprise Integration Patterns with Apache Camel, ActiveMQ and ServiceMix James Strachan http://macstrac.blogspot.com/ http://open.iona.com/
  • 2. What are Enterprise Integration Patterns?
  • 3. Book by Gregor & Bobby!
  • 4. A selection of some of the patterns...
  • 7. Aims of Camel to make integration as simple as it can possibly be
  • 8. What is Camel? http://activemq.apache.org/camel/
  • 9. What is Camel? Spring based Enterprise Integration Patterns http://activemq.apache.org/camel/enterprise-integration-patterns.html
  • 10. A selection of some of the patterns...
  • 11. Lets look at a pattern!
  • 13. Message Filter : XML <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext>
  • 14. Message Filter : Spring XML <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd"> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext> </beans>
  • 15. Message Filter : XML <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext>
  • 16. Expressions & Predicates BeanShell PHP EL Python Groovy Ruby JavaScript SQL JSR 223 XPath OGNL XQuery
  • 17. URIs, Endpoints and Components http://activemq.apache.org/camel/components.html activemq ibatis mail rmi udp activemq.journal imap mina rnc validation bean irc mock rng velocity cxf jdbc msv seda vm direct jetty multicast sftp xmpp event jbi pojo smtp xquery file jms pop string-template xslt ftp jpa quartz timer webdav http log queue tcp
  • 18. Message Filter : XML <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:topic:Quotes"/> <filter> <xpath>/quote/product = ‘widget’</xpath> <to uri="mqseries:WidgetQuotes"/> </filter> </route> </camelContext>
  • 19. Message Filter : Java from("activemq:topic:Quotes). filter().xpath("/quote/product = ‘widget’"). to("mqseries:WidgetQuotes");
  • 20. Message Filter : Java Complete package com.acme.quotes; import org.apache.camel.builder.RouteBuilder; public class MyRouteBuilder extends RouteBuilder { public void configure() { // forward widget quotes to MQSeries from("activemq:topic:Quotes). filter().xpath("/quote/product = ‘widget’"). to("mqseries:WidgetQuotes"); } }
  • 21. Create CamelContext in Java CamelContext context = new DefaultCamelContext(); context.addRoutes(new MyRouteBuilder()); context.start();
  • 22. Create CamelContext in Spring <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <package>com.acme.quotes</package> </camelContext>
  • 25. Content Based Router <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="activemq:NewOrders"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:Orders.Widgets"/> </when> <when> <xpath>/order/product = 'gadget'</xpath> <to uri="activemq:Orders.Gadgets"/> </when> <otherwise> <to uri="activemq:Orders.Bad"/> </otherwise> </choice> </route> </camelContext>
  • 27. Splitter from("file://orders"). splitter(body().tokenize("n")). to("activemq:Order.Items");
  • 28. Splitter using XQuery from("file://orders"). splitter().xquery("/order/items"). to("activemq:Order.Items");
  • 30. Aggregator from("activemq:Inventory.Items"). aggregator().xpath("/order/@id"). to("activemq:Inventory.Order");
  • 32. Message Translator from("file://incoming”). to("xslt:com/acme/mytransform.xsl"). to("http://outgoing.com/foo");
  • 34. Beans
  • 35. Bean as a Message Translator from("activemq:Incoming”). beanRef("myBeanName"). to("activemq:Outgoing");
  • 36. Bean public class Foo { public void someMethod(String name) { ... } }
  • 37. Bean as a Message Translator with method name from("activemq:Incoming”). beanRef("myBeanName", "someMethod"). to("activemq:Outgoing");
  • 39. Type Conversion package com.acme.foo.converters; import org.apache.camel.Converter; import java.io.*; @Converter public class IOConverter { @Converter public static InputStream toInputStream(File file) throws FileNotFoundException { return new BufferedInputStream(new FileInputStream(file)); } } # META-INF/services/org/apache/camel/TypeConverter com.acme.foo.converters
  • 40. Binding Beans to Camel Endpoints public class Foo { @MessageDriven(uri="activemq:cheese") public void onCheese(String name) { ... } }
  • 41. Binding Method Arguments public class Foo { public void onCheese( @XPath("/foo/bar") String name, @Header("JMSCorrelationID") String id) { ... } } for more annotations see http://activemq.apache.org/camel/bean-integration.html
  • 42. Injecting endpoints into beans public class Foo { @EndpointInject(uri="activemq:foo.bar") ProducerTemplate producer; public void doSomething() { if (whatever) { producer.sendBody("<hello>world!</hello>"); } } }
  • 43. Spring Remoting - Client Side <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <proxy id="sayService" serviceUrl="activemq:MyService" serviceInterface="com.acme.MyServiceInterface"/> </camelContext>
  • 44. Spring Remoting - Server Side <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <export id="sayService" uri="activemq:MyService" serviceRef="sayImpl" serviceInterface="com.acme.MyServiceInterface"/> </camelContext> <bean id="sayImpl" class="com.acme.MyServiceImpl"/>
  • 45. Dependency Injection <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> ... </camelContext> <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent"> <property name="connectionFactory"> <bean class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="vm://localhost?broker.persistent=false"/> </bean> </property> </bean>
  • 46. Data Format from("activemq:QueueWithJavaObjects). marshal().jaxb(). to("mqseries:QueueWithXmlMessages");
  • 48. Business Activity Monitoring (BAM) public class MyActivities extends ProcessBuilder { public void configure() throws Exception { // lets define some activities, correlating on an XPath on the message bodies ActivityBuilder purchaseOrder = activity("activemq:PurchaseOrders") .correlate(xpath("/purchaseOrder/@id").stringResult()); ActivityBuilder invoice = activity("activemq:Invoices") .correlate(xpath("/invoice/@purchaseOrderId").stringResult()); // now lets add some BAM rules invoice.starts().after(purchaseOrder.completes()) .expectWithin(seconds(1)) .errorIfOver(seconds(2)).to("activemq:FailedProcesses"); } }
  • 50. Where would I use Camel? •standalone or in any Spring application •inside ActiveMQ’s JMS client or the broker •inside your ESB such as ServiceMix via the servicemix-camel Service Unit •inside CXF either as a transport or reusing CXF inside Camel
  • 51. Camel Riding from Java •/META-INF/spring/camelContext.xml •set the CLASSPATH •java org.apache.camel.spring.Main
  • 52. Maven Tooling <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> mvn camel:run
  • 54. Where do I get more info? please do take Camel for a ride! http://activemq.apache.org/camel/ don’t get the hump! :-)
  • 56. James Strachan blog http://macstrac.blogspot.com/
  • 57. Camel v Mule • A Camel can carry 4 times as much load as other beasts of burden! http://activemq.apache.org/camel/why-the-name-camel.html
  • 58. Camel v Mule •Camel provides a higher level abstraction for EIP; making it simpler & easier & less XML •Awesome integration with JMS + ActiveMQ (client and broker), JBI + ServiceMix and JAX-WS + CXF •great testing with Camel’s Mock Endpoint •Business Activity Monitoring framework
  • 59. Where do I get more info? please do take Camel for a ride! http://activemq.apache.org/camel/ don’t get the hump! :-)