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
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
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
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
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.
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
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
Some of these components are read-only, some are long-running, some are not.
can pass around any kind of message in any data format. only marshal/unmarshal when oyu need to
too many moving parts to show, but you can setup a new component in ~ 20 minutes or so
our customers love it, most of have already invested in services to manage java daemons
HTTP posts are backed by Mina, mail backed by JavaMail, etc
you will extend some really good camel default classes