3
• What is Integration?
• Camel… what?
• Honestly… Camel Rox!
• Demo time!
• Questions? Yah… over beer J
Agenda
4
Your speaker
Christian Posta
Blog: http://christianposta.com/blog
Twitter: @christianposta
Email: christian@redhat.com
• Principal Middleware Specialist/Architect
• Based in Phoenix, AZ
• Committer on Apache Camel, ActiveMQ, Apollo
• Author: Essential Camel Components DZone Refcard
7
• Off the shelf? Home Grown? Acquisition?
• Platforms
• Protocols / Data Formats
• Data Formats
• Timing
• Organizational mismatch
Integration L
8
• Common language!!!!!
• Specific context
• Forces at work
• Concrete solution
• Guidance
• 65 patterns
Patterns FTW!
9
• Protocol mediation
• Routing, Transformation, EIPs
• Start small, build up, ESB if needed
• Open Source
• Community driven
Lightweight integration, right?
Consume XML doc from file system, put onto
messaging queue, separately consume from queue,
do some routing, archive to file system.
Logging, tracing, debugging. Also implement
flexibility, HA messaging, scalability.
• Clearly cannot be done
• A few months
• A few weeks
• A few Days
• < 1 day10
12
Apache Camel
Apache Camel is an open-source,
light-weight, integration library.
Use Camel to integrate disparate systems
that speak different protocols and data formats
13
• Light-weight integration library
• Domain Specific Language
• Enterprise Integration Patterns
• Components
• Routing and Mediation (like an ESB?)
• Runs in any container (or stand alone)
What is Apache Camel?
20
• Defined in Java, XML, Scala, Groovy DSL
• Step by step processing of a message:
• Consumer – Listen for incoming message
• Zero or more “filters” or Processors
• Producer – Send outgoing message
• Pipeline of “filters” or “processors”
• EIPs
• Tranformation
• Expressions
• Exceptions
Camel Routes
21
•
Domain Specific Language
• Domain specific (integration)
• Build and describe integration flows
• Embedded within a general programming language
• Java, Spring XML, Scala, Groovy
• Take advantage of existing tools
• Fluent builders (builder pattern…)
• from(“..”).enrich(“…”).filter(“..”).to(“…”);
22
public class OrderProcessorRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from(“activemq:orders”)
.choice()
.when(header(“customer-rating”).isEqualTo(“gold”))
.to(“ibmmq:topic:specialCustomer”)
.otherwise()
.to(“ftp://user@host/orders/regularCustomers”)
.end()
.log(“received new order ${body.orderId}”)
.to(“ibatis:storeOrder?statementType=Insert”);
}
}
25
Components
• ActiveMQ, Websphere, Weblogic (JMS)
• AMQP
• ATOM feeds
• AWS (S3, SQS, SNS, others)
• Bean
• Cache (EHCache)
• CXF (JAX-WS, JAX-RS)
• EJB
• Drools
• File
• FTP
• Google App Engine
• GMail
• HTTP
• IRC
• jclouds
• JDBC
• Jetty
• Twitter
• MQTT
• MyBatis
• JPA
• Spring Integration
• Spring Web Services
http://camel.apache.org/components.html
To see list of all
components!!
26
• URI format:
• scheme:localPart[?options]
• scheme: identifies the “component”
• localPart: specific to the component
• options: is a list of name-value pairs
• Creates endpoints based on configuration
• Route endpoint “factories”
• Integrate with Camel Routes by creating producer/
consumer endpoints
Components
from(“aws-sqs://demo?defaultVisibilityTimeout=2”)
27
Another Example
public class MyExampleRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from(“aws-sqs://demo?defaultVisibilityTimeout=2”)
.setHeader(“type”).jsonpath(“$[‘type’]”)
.filter(simple(“${header.type} == ‘login’”)
.to(“jms:quote”);
}
}
34
Professional Training
Camel Development with Red Hat JBoss Fuse
http://www.redhat.com/training/courses/jb421r/
Red Hat JBoss A-MQ Development and Deployment
https://www.redhat.com/training/courses/jb437r/
Red Hat Certificate of Expertise in Camel Development
http://www.redhat.com/training/certifications/jbcd-camel-development/