Upload
marcelo-jabali
View
2.043
Download
2
Embed Size (px)
DESCRIPTION
Citation preview
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 1 A Progress Software Company
A Progress Software Company
Apache Camel OverviewOpen Source Integration and Messaging
Marcelo JabaliSr. Solutions ConsultantDec., 2011
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 2 A Progress Software Company
Agenda
Apache Camel Overview Architecture Routes, Endpoints, Components Deployment Options
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 3 A Progress Software Company
About Me
Marcelo JabaliSr. Solutions Consultant
marcelojabali.blogspot.com
mjabali
linkedin.com/in/jabali
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 4 A Progress Software Company
Apache Camel
Apache Camel is a powerful Open Source Integration Framework based on known Enterprise Integration Patterns
http://enterpriseintegrationpatterns.com/
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 5 A Progress Software Company
Apache Camel - Patterns
50+ Enterprise Integration Patterns
http://camel.apache.org/eip
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 6 A Progress Software Company
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
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 7 A Progress Software Company
Apache Camel - Architecture
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 8 A Progress Software Company
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)
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 9 A Progress Software Company
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)
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 10 A Progress Software Company
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
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 11 A Progress Software Company
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
Consumer Processor Producer
FTP JMS
Camel Route
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 12 A Progress Software Company
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
Consumer Processor Producer
FTP JMS
Camel Route
activemq:queue:MyQueue
ftp://john@localhost/ftp?password=xxx
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 13 A Progress Software Company
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
Consumer Processor Producer
FTP JMS
Camel Route
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 14 A Progress Software Company
Apache Camel – Sample Route
Java DSL from("ftp://john@localhost/ftp?password=xxx") .to("xslt:MyTransform.xslt") .to("activemq:queue:MyQueue")
Consumer Processor Producer
FTP JMS
Camel Route
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 15 A Progress Software Company
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>
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 16 A Progress Software Company
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; }}
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 17 A Progress Software Company
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 pluginmvn 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)
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 18 A Progress Software Company
Camel Testing Options
Test Kit• camel-test JAR (JUnit)• camel-testng JAR (TestNG)• Supports Spring• Easy to test• Quick prototyping
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 19 A Progress Software Company
Camel Deployment Options
Deployment Strategy• No Container dependency• Lightweight• Embeddable
Deployment Options• Standalone• WAR• Spring• JEE• OSGi• Cloud
Common Containers
Apache ServiceMixApache ActiveMQApache TomcatJettyJBossIBM WebSphereOracle WebLogicOracle OC4jGlassfishGoogle App EngineAmazon EC2... others
Copyright © 2011 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved. 20 A Progress Software Company
A Progress Software Company
Thanks!
No vendor lock-inFree to redistribute
Enterprise class