SlideShare a Scribd company logo
1 of 36
Download to read offline
Elegant Systems Integration
    with Apache Camel
       Pradeep Elankumaran
           Intridea, Inc.
       pradeep@intridea.com
            @pradeep24
About Us

❖   Intridea is a high-end web consulting shop

❖   Based out of Washington DC, but dispersed all over the
    United States

❖   Our most popular product is Presently, an enterprise
    microblogging platform

❖   Specialize in development using Ruby, Rails, Java, Erlang
    and beyond
What’s the Problem?

❖   Most web applications require a suite of supporting services

    ❖   ex: email queue, RSS import, notification emails, etc.

❖   Many great libraries, but hard to identify best-of-breed

❖   Effort required to stitch together custom supporting
    services and backends for every new site
What is Apache Camel?
                        (marketing-speak)




❖   Message-Oriented Middleware

❖   Rule-based message routing

❖   Message mediation engine

❖   Apache 2 License
What is Apache Camel?
                              (plain-speak)


❖   a Routing Engine

❖   Provides you pluggable Components ex: JMS, RSS, SMTP, IMAP, XMPP

❖   Can define chains of components, allowing messages to flow
    from one component to another - routes.

❖   Can convert messages from one format to another within
    these routes

❖   Very extensible - can add your own app-specific components

❖   Very fast & lean
A Few Code Examples
A Basic Camel Route

              from the ‘EmailQueue’ ActiveMQ queue


from(“active-mq:queue:/EmailQueue”).
  to(“smtp://user@smtp.intridea.com?
      password=mypassword&to=pradeep@intridea.com”)


     deliver directly to pradeep@intridea.com via SMTP
A Bit More Advanced...
                                                    throttle the queue
                                                   to 10 XMPP stanzas
                                                     every 20 seconds

from(“active-mq:queue:/XMPPQueue”).                           converts JSON from the
  throttle(10).timePeriodMillis(20000).                      queue to a XMPP message
  unmarshal().json(JsonLibrary.JACKSON).                      using the Jackson JSON
                                                                       library
      to(“xmpp://pradeep@jabber.org/?
         room=krypton@conference.jabber.org&password=secret”)


                       send every message to the ‘krypton’
                          chat room via XMPP on the
                                jabber.org server
A Long-Running Route

                from the reddit.com RSS feed


     from(“rss:http://reddit.com/.rss?splitEntries=true”).
       marshal().rss().
       filter().xpath(“//item/title[contains(., ‘Montreal’)]”).
         process(new MyCustomRSSProcessor()).
           to(“mina:tcp://mywebapp.com/postToApp”)

                                                        run matched messages through a
filter messages by XPath                                custom processor that converts to
                                                            your special data format

                      POSTs final message to this URL
Camel is Powerful.
Component List
ActiveMQ    Freemarker      JPA         RMI     StringTemplate
 AMQP           FTP       JT/400       RNC           TCP
  Atom        GHttp       LDAP         RNG            Test
   Bean        GTask        Log         RSS          Timer
 Browse        GMail       Mail        SEDA          UDP
  Cache     Hibernate     MINA       SERVLET       Validation
 Cometd         HL7        Mock        SFTP         Velocity
   CXF        HTTP         MSV        Smooks          VM
 CXFRS         IMAP      Multicast     SMTP         XMPP
 DataSet        IRC        NMR        SNMP          XQuery
  Direct     JavaSpace     POP         Spring        XSLT
  Esper          JBI      Printer       SQL
  Event         JCR       Quartz      Stream
   File        JDBC      Quickfix
 Flatpack       Jetty       Ref
                JMS       Restlet
Can hook up most of these
components with each other.
Camel allows you to be
 data-format agnostic
Can add new, custom
components very easily
Camel integrates with Spring
      using an XML/POJO based Spring DSL
Robust Error-Handling DSL

 errorHandler(defaultErrorHandler().
 	 maximumRedeliveries(2).
    backOffMultiplier(2).
 	 retryAttemptedLogLevel(LoggingLevel.WARN));

 onException(IOException.class).
 	 maximumRedeliveries(3).
    redeliverDelay(1000);
A Real-World Case Study
       Present.ly
What is Present.ly?

❖   Enterprise Micro-blogging platform

❖   Written in Ruby on Rails

❖   A pretty big XMPP component for message delivery

❖   Requires a lot of supporting architecture/daemons
Pre-Camel Architecture
               Rails                     eJabberd (XMPP)


                                         Notifs Processor


                                          Email Sender


             Queue               RUBY     Daily Digests


                                         IMAP Processor


                                           IM Gateway
multiple ruby daemons we had to manage
Present.ly w/ Camel
                                       eJabberd (XMPP)


 Rails                                 Notifs Processor


     STOMP protocol                     Email Sender


ActiveMQ              Camel     JAVA    Daily Digests


                                       IMAP Processor


                                         IM Gateway
      one easy-to-deploy .jar file,
        can easily interface with       Feed Fetcher
         different architectures
Easy to setup
Shared-Nothing
 app instances
Camel in Detail
All Camel code runs inside a
      CamelContext
                                Type
 Components                   Converters



 Endpoints    CamelContext   Data Formats



   Routes                     Languages
Most of the components are
 backed by stable, best-of-
    breed Java libraries
Processing and Filtering
 messages is very easy
One Final Example
import   org.apache.activemq.camel.component.ActiveMQComponent;
import   org.apache.camel.CamelContext;
import   org.apache.camel.Exchange;
import   org.apache.camel.Processor;
import   org.apache.camel.builder.RouteBuilder;
import   org.apache.camel.impl.DefaultCamelContext;

public   class MyCamelRouter {

        public static void main(String args[]) throws Exception {

        
      // initialize a new CamelContext

        
      CamelContext context = new DefaultCamelContext();

        
      // attach the ActiveMQ component

        
      context.addComponent("active-mq",

        
      
        ActiveMQComponent.activeMQComponent("tcp://localhost:81816"));

        

        
      context.addRoutes(new RouteBuilder(){

        
      
        public void configure() {

        
      
        
       // setup a new route

        
      
        
       from("active-mq:queue:/MyRandomQueue").

        
      
        
       throttle(5).timePeriodMillis(10000).

        
      
        
       process(new Processor() {

        
      
        
       
       public void process(Exchange exchange) {

        
      
        
       
       
       System.out.println("RECV: "+exchange.getIn().getBody(String.class));

        
      
        
       
       }

        
      
        
       }).to("mina:tcp://mywebsite.com/");

        
      
        }

        
      });

        }
}
Learn more...
Enterprise Integration
            Patterns (EIP)
❖   Many recipes for common integration issues

❖   Excellent book by Gregor Hohpe and Bobby Woolf

❖   Camel formalizes the language for a very big subset of the
    patterns listed in this book

❖   Leverage the patterns to create scalable architectures for
    your application using the tools Camel gives you.
Examples of EIP Patterns
Examples of EIP Patterns
Learning More Camel

❖   Website is very comprehensive

❖   Downloadable Manual
❖   Mailing lists are handy

❖   Email me! pradeep@intridea.com

❖   Camel in Action by Claus Ibsen, Jonathan Anstey & Hadrian Zbarcea
Questions?
      Reach me at
pradeep@intridea.com
     @pradeep24
Something new...
Llama

❖   A port of Camel to Ruby

❖   based off EventMachine, so it runs ROCK SOLID

❖   early alpha at this point, looking for helpers

❖   github.com/skyfallsin/llama
Llama Code Example
github.com/skyfallsin/llama

More Related Content

What's hot

Apache james more than emails in the cloud
Apache james  more than emails in the cloudApache james  more than emails in the cloud
Apache james more than emails in the cloudIoan Eugen Stan
 
Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQNahidul Kibria
 
TorqueBox at GNUnify 2012
TorqueBox at GNUnify 2012TorqueBox at GNUnify 2012
TorqueBox at GNUnify 2012Saleem Ansari
 
Rabbitmq & Kafka Presentation
Rabbitmq & Kafka PresentationRabbitmq & Kafka Presentation
Rabbitmq & Kafka PresentationEmre Gündoğdu
 
Messaging in the Cloud - AMQP, RabbitMQ and Spring
Messaging in the Cloud - AMQP, RabbitMQ and SpringMessaging in the Cloud - AMQP, RabbitMQ and Spring
Messaging in the Cloud - AMQP, RabbitMQ and SpringEberhard Wolff
 
StormMQ Introduction to AMQP, Dublin
StormMQ Introduction to AMQP, DublinStormMQ Introduction to AMQP, Dublin
StormMQ Introduction to AMQP, DublinStormMQ
 
An Introduction to AMQP with Code Samples
An Introduction to AMQP with Code SamplesAn Introduction to AMQP with Code Samples
An Introduction to AMQP with Code SamplesStormMQ
 
XMPP & AMQP in Ruby
XMPP & AMQP in RubyXMPP & AMQP in Ruby
XMPP & AMQP in RubyMatt Todd
 
RabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeRabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeLenz Gschwendtner
 
Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0StreamNative
 
Rabbit MQ introduction
Rabbit MQ introductionRabbit MQ introduction
Rabbit MQ introductionShirish Bari
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQKnoldus Inc.
 
Streaming Design Patterns Using Alpakka Kafka Connector (Sean Glover, Lightbe...
Streaming Design Patterns Using Alpakka Kafka Connector (Sean Glover, Lightbe...Streaming Design Patterns Using Alpakka Kafka Connector (Sean Glover, Lightbe...
Streaming Design Patterns Using Alpakka Kafka Connector (Sean Glover, Lightbe...confluent
 
Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQZoran Majstorovic
 
Full Stack Bus with Javascript, RabbitMQ and Postal.js
Full Stack Bus with Javascript, RabbitMQ and Postal.jsFull Stack Bus with Javascript, RabbitMQ and Postal.js
Full Stack Bus with Javascript, RabbitMQ and Postal.jsJavier Arias Losada
 
Troubleshooting RabbitMQ and services that use it
Troubleshooting RabbitMQ and services that use itTroubleshooting RabbitMQ and services that use it
Troubleshooting RabbitMQ and services that use itMichael Klishin
 
RabbitMQ vs Apache Kafka - Part 1
RabbitMQ vs Apache Kafka - Part 1RabbitMQ vs Apache Kafka - Part 1
RabbitMQ vs Apache Kafka - Part 1Erlang Solutions
 
Kafka as a message queue
Kafka as a message queueKafka as a message queue
Kafka as a message queueSoftwareMill
 

What's hot (20)

Apache james more than emails in the cloud
Apache james  more than emails in the cloudApache james  more than emails in the cloud
Apache james more than emails in the cloud
 
Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQ
 
TorqueBox at GNUnify 2012
TorqueBox at GNUnify 2012TorqueBox at GNUnify 2012
TorqueBox at GNUnify 2012
 
Rabbitmq & Kafka Presentation
Rabbitmq & Kafka PresentationRabbitmq & Kafka Presentation
Rabbitmq & Kafka Presentation
 
Messaging in the Cloud - AMQP, RabbitMQ and Spring
Messaging in the Cloud - AMQP, RabbitMQ and SpringMessaging in the Cloud - AMQP, RabbitMQ and Spring
Messaging in the Cloud - AMQP, RabbitMQ and Spring
 
StormMQ Introduction to AMQP, Dublin
StormMQ Introduction to AMQP, DublinStormMQ Introduction to AMQP, Dublin
StormMQ Introduction to AMQP, Dublin
 
An Introduction to AMQP with Code Samples
An Introduction to AMQP with Code SamplesAn Introduction to AMQP with Code Samples
An Introduction to AMQP with Code Samples
 
XMPP & AMQP in Ruby
XMPP & AMQP in RubyXMPP & AMQP in Ruby
XMPP & AMQP in Ruby
 
RabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = AwesomeRabbitMQ + CouchDB = Awesome
RabbitMQ + CouchDB = Awesome
 
Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0
 
Devignition 2011
Devignition 2011Devignition 2011
Devignition 2011
 
Rabbit MQ introduction
Rabbit MQ introductionRabbit MQ introduction
Rabbit MQ introduction
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQ
 
Streaming Design Patterns Using Alpakka Kafka Connector (Sean Glover, Lightbe...
Streaming Design Patterns Using Alpakka Kafka Connector (Sean Glover, Lightbe...Streaming Design Patterns Using Alpakka Kafka Connector (Sean Glover, Lightbe...
Streaming Design Patterns Using Alpakka Kafka Connector (Sean Glover, Lightbe...
 
Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQ
 
Full Stack Bus with Javascript, RabbitMQ and Postal.js
Full Stack Bus with Javascript, RabbitMQ and Postal.jsFull Stack Bus with Javascript, RabbitMQ and Postal.js
Full Stack Bus with Javascript, RabbitMQ and Postal.js
 
Troubleshooting RabbitMQ and services that use it
Troubleshooting RabbitMQ and services that use itTroubleshooting RabbitMQ and services that use it
Troubleshooting RabbitMQ and services that use it
 
RabbitMQ vs Apache Kafka - Part 1
RabbitMQ vs Apache Kafka - Part 1RabbitMQ vs Apache Kafka - Part 1
RabbitMQ vs Apache Kafka - Part 1
 
i <3 email
i <3 emaili <3 email
i <3 email
 
Kafka as a message queue
Kafka as a message queueKafka as a message queue
Kafka as a message queue
 

Similar to Elegant Systems Integration w/ Apache Camel

Enterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQEnterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQelliando dias
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011bobmcwhirter
 
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013Charles Moulliard
 
Near real time streaming with apache samza - Antispam use case
Near real time streaming with apache samza - Antispam use caseNear real time streaming with apache samza - Antispam use case
Near real time streaming with apache samza - Antispam use caseMichael Sklyar
 
Service messaging using Kafka
Service messaging using KafkaService messaging using Kafka
Service messaging using KafkaRobert Vadai
 
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Claus Ibsen
 
The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP Eberhard Wolff
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPEberhard Wolff
 
Apache Kafka
Apache KafkaApache Kafka
Apache KafkaJoe Stein
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusClaus Ibsen
 
Introducing KSML: Kafka Streams for low code environments | Jeroen van Dissel...
Introducing KSML: Kafka Streams for low code environments | Jeroen van Dissel...Introducing KSML: Kafka Streams for low code environments | Jeroen van Dissel...
Introducing KSML: Kafka Streams for low code environments | Jeroen van Dissel...HostedbyConfluent
 
Enterprise Integration Patterns with Camel
Enterprise Integration Patterns with CamelEnterprise Integration Patterns with Camel
Enterprise Integration Patterns with CamelSoftware Infrastructure
 
Down the RabbitMQ Hole
Down the RabbitMQ HoleDown the RabbitMQ Hole
Down the RabbitMQ HoleBizTalk360
 
London hug-samza
London hug-samzaLondon hug-samza
London hug-samzahuguk
 
Apache Samza: Reliable Stream Processing Atop Apache Kafka and Hadoop YARN
Apache Samza: Reliable Stream Processing Atop Apache Kafka and Hadoop YARNApache Samza: Reliable Stream Processing Atop Apache Kafka and Hadoop YARN
Apache Samza: Reliable Stream Processing Atop Apache Kafka and Hadoop YARNblueboxtraveler
 
TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011Lance Ball
 
Integrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQIntegrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQGavin Roy
 

Similar to Elegant Systems Integration w/ Apache Camel (20)

Enterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQEnterprise Messaging with Apache ActiveMQ
Enterprise Messaging with Apache ActiveMQ
 
Messaging in Java
Messaging in JavaMessaging in Java
Messaging in Java
 
TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011
 
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013
 
Near real time streaming with apache samza - Antispam use case
Near real time streaming with apache samza - Antispam use caseNear real time streaming with apache samza - Antispam use case
Near real time streaming with apache samza - Antispam use case
 
Service messaging using Kafka
Service messaging using KafkaService messaging using Kafka
Service messaging using Kafka
 
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
 
The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQP
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel Quarkus
 
Introducing KSML: Kafka Streams for low code environments | Jeroen van Dissel...
Introducing KSML: Kafka Streams for low code environments | Jeroen van Dissel...Introducing KSML: Kafka Streams for low code environments | Jeroen van Dissel...
Introducing KSML: Kafka Streams for low code environments | Jeroen van Dissel...
 
XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)
 
AD102 - Break out of the Box
AD102 - Break out of the BoxAD102 - Break out of the Box
AD102 - Break out of the Box
 
Enterprise Integration Patterns with Camel
Enterprise Integration Patterns with CamelEnterprise Integration Patterns with Camel
Enterprise Integration Patterns with Camel
 
Down the RabbitMQ Hole
Down the RabbitMQ HoleDown the RabbitMQ Hole
Down the RabbitMQ Hole
 
London hug-samza
London hug-samzaLondon hug-samza
London hug-samza
 
Apache Samza: Reliable Stream Processing Atop Apache Kafka and Hadoop YARN
Apache Samza: Reliable Stream Processing Atop Apache Kafka and Hadoop YARNApache Samza: Reliable Stream Processing Atop Apache Kafka and Hadoop YARN
Apache Samza: Reliable Stream Processing Atop Apache Kafka and Hadoop YARN
 
TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011
 
Integrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQIntegrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQ
 

Elegant Systems Integration w/ Apache Camel

  • 1. Elegant Systems Integration with Apache Camel Pradeep Elankumaran Intridea, Inc. pradeep@intridea.com @pradeep24
  • 2. About Us ❖ Intridea is a high-end web consulting shop ❖ Based out of Washington DC, but dispersed all over the United States ❖ Our most popular product is Presently, an enterprise microblogging platform ❖ Specialize in development using Ruby, Rails, Java, Erlang and beyond
  • 3. What’s the Problem? ❖ Most web applications require a suite of supporting services ❖ ex: email queue, RSS import, notification emails, etc. ❖ Many great libraries, but hard to identify best-of-breed ❖ Effort required to stitch together custom supporting services and backends for every new site
  • 4. What is Apache Camel? (marketing-speak) ❖ Message-Oriented Middleware ❖ Rule-based message routing ❖ Message mediation engine ❖ Apache 2 License
  • 5. What is Apache Camel? (plain-speak) ❖ a Routing Engine ❖ Provides you pluggable Components ex: JMS, RSS, SMTP, IMAP, XMPP ❖ Can define chains of components, allowing messages to flow from one component to another - routes. ❖ Can convert messages from one format to another within these routes ❖ Very extensible - can add your own app-specific components ❖ Very fast & lean
  • 6. A Few Code Examples
  • 7. A Basic Camel Route from the ‘EmailQueue’ ActiveMQ queue from(“active-mq:queue:/EmailQueue”). to(“smtp://user@smtp.intridea.com? password=mypassword&to=pradeep@intridea.com”) deliver directly to pradeep@intridea.com via SMTP
  • 8. A Bit More Advanced... throttle the queue to 10 XMPP stanzas every 20 seconds from(“active-mq:queue:/XMPPQueue”). converts JSON from the throttle(10).timePeriodMillis(20000). queue to a XMPP message unmarshal().json(JsonLibrary.JACKSON). using the Jackson JSON library to(“xmpp://pradeep@jabber.org/? room=krypton@conference.jabber.org&password=secret”) send every message to the ‘krypton’ chat room via XMPP on the jabber.org server
  • 9. A Long-Running Route from the reddit.com RSS feed from(“rss:http://reddit.com/.rss?splitEntries=true”). marshal().rss(). filter().xpath(“//item/title[contains(., ‘Montreal’)]”). process(new MyCustomRSSProcessor()). to(“mina:tcp://mywebapp.com/postToApp”) run matched messages through a filter messages by XPath custom processor that converts to your special data format POSTs final message to this URL
  • 11. Component List ActiveMQ Freemarker JPA RMI StringTemplate AMQP FTP JT/400 RNC TCP Atom GHttp LDAP RNG Test Bean GTask Log RSS Timer Browse GMail Mail SEDA UDP Cache Hibernate MINA SERVLET Validation Cometd HL7 Mock SFTP Velocity CXF HTTP MSV Smooks VM CXFRS IMAP Multicast SMTP XMPP DataSet IRC NMR SNMP XQuery Direct JavaSpace POP Spring XSLT Esper JBI Printer SQL Event JCR Quartz Stream File JDBC Quickfix Flatpack Jetty Ref JMS Restlet
  • 12. Can hook up most of these components with each other.
  • 13. Camel allows you to be data-format agnostic
  • 14. Can add new, custom components very easily
  • 15. Camel integrates with Spring using an XML/POJO based Spring DSL
  • 16. Robust Error-Handling DSL errorHandler(defaultErrorHandler(). maximumRedeliveries(2). backOffMultiplier(2). retryAttemptedLogLevel(LoggingLevel.WARN)); onException(IOException.class). maximumRedeliveries(3). redeliverDelay(1000);
  • 17. A Real-World Case Study Present.ly
  • 18. What is Present.ly? ❖ Enterprise Micro-blogging platform ❖ Written in Ruby on Rails ❖ A pretty big XMPP component for message delivery ❖ Requires a lot of supporting architecture/daemons
  • 19. Pre-Camel Architecture Rails eJabberd (XMPP) Notifs Processor Email Sender Queue RUBY Daily Digests IMAP Processor IM Gateway multiple ruby daemons we had to manage
  • 20. Present.ly w/ Camel eJabberd (XMPP) Rails Notifs Processor STOMP protocol Email Sender ActiveMQ Camel JAVA Daily Digests IMAP Processor IM Gateway one easy-to-deploy .jar file, can easily interface with Feed Fetcher different architectures
  • 23. All Camel code runs inside a CamelContext Type Components Converters Endpoints CamelContext Data Formats Routes Languages
  • 24. Most of the components are backed by stable, best-of- breed Java libraries
  • 25. Processing and Filtering messages is very easy
  • 26. One Final Example import org.apache.activemq.camel.component.ActiveMQComponent; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; public class MyCamelRouter { public static void main(String args[]) throws Exception { // initialize a new CamelContext CamelContext context = new DefaultCamelContext(); // attach the ActiveMQ component context.addComponent("active-mq", ActiveMQComponent.activeMQComponent("tcp://localhost:81816")); context.addRoutes(new RouteBuilder(){ public void configure() { // setup a new route from("active-mq:queue:/MyRandomQueue"). throttle(5).timePeriodMillis(10000). process(new Processor() { public void process(Exchange exchange) { System.out.println("RECV: "+exchange.getIn().getBody(String.class)); } }).to("mina:tcp://mywebsite.com/"); } }); } }
  • 28. Enterprise Integration Patterns (EIP) ❖ Many recipes for common integration issues ❖ Excellent book by Gregor Hohpe and Bobby Woolf ❖ Camel formalizes the language for a very big subset of the patterns listed in this book ❖ Leverage the patterns to create scalable architectures for your application using the tools Camel gives you.
  • 29. Examples of EIP Patterns
  • 30. Examples of EIP Patterns
  • 31. Learning More Camel ❖ Website is very comprehensive ❖ Downloadable Manual ❖ Mailing lists are handy ❖ Email me! pradeep@intridea.com ❖ Camel in Action by Claus Ibsen, Jonathan Anstey & Hadrian Zbarcea
  • 32. Questions? Reach me at pradeep@intridea.com @pradeep24
  • 34. Llama ❖ A port of Camel to Ruby ❖ based off EventMachine, so it runs ROCK SOLID ❖ early alpha at this point, looking for helpers ❖ github.com/skyfallsin/llama

Editor's Notes

  1. Note that components are initialized by a URI - this is very camel-specific. each component has it’s own URI and there are over 50 components API contains a list of components with their URI schemes
  2. Some of these components are read-only, some are long-running, some are not.
  3. can pass around any kind of message in any data format. only marshal/unmarshal when oyu need to
  4. too many moving parts to show, but you can setup a new component in ~ 20 minutes or so
  5. our customers love it, most of have already invested in services to manage java daemons
  6. HTTP posts are backed by Mina, mail backed by JavaMail, etc
  7. you will extend some really good camel default classes
  8. want to get rid of these