More Related Content Similar to Apache camel overview dec 2011 (20) Apache camel overview dec 20111. Apache Camel Overview
Open Source Integration and Messaging
Marcelo Jabali
Sr. Solutions Consultant
Dec., 2011
A Progress Software Company
1 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
2. Agenda
Apache Camel Overview
Architecture
Routes, Endpoints, Components
Deployment Options
2 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
3. About Me
Marcelo Jabali
Sr. Solutions Consultant
marcelo@fusesource.com
marcelojabali.blogspot.com
mjabali
linkedin.com/in/jabali
3 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
4. Apache Camel
Apache Camel is a
powerful Open
Source Integration
Framework based on
known Enterprise
Integration Patterns
http://enterpriseintegrationpatterns.com/
4 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
5. Apache Camel - Patterns
50+ Enterprise Integration Patterns
http://camel.apache.org/eip
5 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
6. Apache Camel – Components, Data Formats and
Languages
80 Components (activemq, bean, cxf, file, ftp, hibernate, jdbc,
ibatis, jms, jetty, mina, netty, timer, xslt, etc)
• http://camel.apache.org/components.html
19 Data Formats (csv, serialization, zip, hl7, soap, jaxb, etc)
• http://camel.apache.org/data-format.html
15 Expression Languages (EL, Simple, XQuery, Xpath,
JavaScript, Ruby, Python, PHP, etc)
• http://camel.apache.org/languages.html
6 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
7. Apache Camel - Architecture
7 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
8. What is a Camel Route?
A Route is the step-by-step movement of a message:
• From a “listening” endpoint in the role of consumer
• Through a processing component - enterprise integration pattern,
processor, interceptor, etc. (optional)
• To a target endpoint in the role of producer
May involve any number of processing components that
modify the original message and/or redirect it
An application developer specifies routes using:
• Spring configuration files
• Java Domain Specific Language (DSL)
8 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
9. Apache Camel – DSL (Domain Specific Language)
Camel provides an embedded DSL (in Java, Spring or Scala) for
implementing enterprise integration patterns
• The DSL uses URIs to define endpoints which are combined to
generate routes (integration flows)
9 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
10. Apache Camel - Components
A Component is essentially a factory of Endpoint instances
+80 Components available
activemq cxf rss sql
mail/imap/pop3 cxfrs snmp timer
amqp dataset ftp/ftps/sftp jbi
atom db4o velocity jcr
bean direct restlet jdbc
ldap ejb hibernate jetty
browse xquery hl7 jms
cache quartz http jmx
mock exec ibatis jpa
netty file irc xslt
10 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
11. Apache Camel - Endpoints
An Endpoint is an instance of the component that can
create or receive messages, for example, an FTP server, a
Web Service, or a JMS broker
Camel allows you to specifiy endpoints using simple URIs
• ftp://john@localhost/ftp?password=xxx
• activemq:queue:MyQueue
Camel Route
FTP JMS
Consumer Processor Producer
11 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
12. Apache Camel - Consumers and Producers
Message Consumers and Producers are created from
endpoints
• Some endpoint technologies can create producers and
consumers, others support the creation of either a producer or a
consumer
ftp://john@localhost/ftp?password=xxx
Camel Route
FTP JMS
Consumer Processor Producer
activemq:queue:MyQueue
12 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
13. Apache Camel - Sample Route
Typical scenario: "read an XML file from an FTP server,
process it using XSLT, and then send it to a JMS queue”
• It's natural to consider an FTP consumer that 'consumes' the
message…
• … which gets sent to a 'processor' for transformation …
• … which gets sent to a JMS message producer for placement on
the queue
Camel Route
FTP JMS
Consumer Processor Producer
13 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
14. Apache Camel – Sample Route
Java DSL
from("ftp://john@localhost/ftp?password=xxx")
.to("xslt:MyTransform.xslt")
.to("activemq:queue:MyQueue")
Camel Route
FTP JMS
Consumer Processor Producer
14 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
15. Apache Camel – Sample Route
Spring XML DSL
<camelContext id=“camel”
xmlns=“http://activemq.apache.org/camel/schema/spring”>
<route>
<from uri=“ftp://john@localhost/ftp?password=xxx”/>
<to uri=“xslt:MyTransform.xslt”/>
<to uri=“activemq:queue:MyQueue”/>
</route>
</camelContext>
Clean Integration with Spring Beans
<bean id=“activemq”
class=“org.apache.activemq.camel.component.ActiveMQComponent”>
<property name=“brokerURL” value=“tcp://localhost:61616”/>
</bean>
15 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
16. Apache Camel – Spring Bean Integration
Spring Bean as Message Translator
from("activemq:queue:Incoming”).
beanRef("myBeanName", "someMethod").
to("activemq:Outgoing");
public class Foo {
public String someMethod(String name) {
return “Hello “ + name;
}
}
16 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
17. Typical Camel Route Development Process
Use a Maven archetype to generate an outline project
Edit the POM to include additional dependencies
Add your Java code into src/main/java, and/or Spring
configuration to src/main/resources/META-INF/spring
Add instructions to the Maven Felix plugin, to assist in the generation
of OSGi manifest information
Test using the Camel Maven plugin
mvn camel:run
Deploy into the Apache ServiceMix OSGi container
• Drop into deploy/ directory (pre-production testing)
• Install a bundle/feature from a maven repository (production environment)
17 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
18. Camel Testing Options
Test Kit
• camel-test JAR (JUnit)
• camel-testng JAR (TestNG)
• Supports Spring
• Easy to test
• Quick prototyping
18 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
19. Camel Deployment Options
Deployment Strategy Common Containers
• No Container dependency
• Lightweight Apache ServiceMix
Apache ActiveMQ
• Embeddable Apache Tomcat
Deployment Options Jetty
JBoss
• Standalone IBM WebSphere
• WAR Oracle WebLogic
• Spring Oracle OC4j
Glassfish
• JEE Google App Engine
• OSGi Amazon EC2
• Cloud ... others
19 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
20. Thanks!
No vendor lock-in
Free to redistribute
Enterprise class A Progress Software Company
20 Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. A Progress Software Company
Editor's Notes Very simplified view of Camel’s architectureComponents are the extension point in Camel to add connectivity to other systems. The core of Camel is very small to keep dependencies low, promote embeddability, etc. and as a result contains only 12 essential components. There are over 60 components outside the core. To expose these systems to the rest of Camel, Components provide an Endpoint interface. By using URIs, you can send or receive messages on Endpoints in a uniform way. For instance, to receive messages from a JMS queue aQueue and send them to a file system directory "c:/tmp", you could use URIs like "jms:aQueue" and "file:c:\\tmp".Processors are used to manipulate and mediate messages in between Endpoints. All of the EIPs are defined as Processors or sets of Processors. As of writing, Camel supports 41 patterns from the EIP book, 6 other integration patterns, and many other useful Processors.To wire Processors and Endpoints together, Camel defines a Java DSL. The term DSL is used a bit loosely here as it usually implies the involvement of a compiler or interpreter that can process keywords specific to a particular domain. In Camel, DSL means a fluent Java API that contains methods named like terms from the EIP book To wire processors and endpoints together to form routes, Camel defines a DSL. The term DSL is used a bit loosely here. In Camel, DSL means a fluent Java API that con- tains methods named for EIP terms. Camel Demo + FUSE IDE Demo