SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
1.
2
2
Simplify Enterprise Integration
With
Apache Camel and Fuse
Christian Posta
Principal Middleware Specialist/Architect
2.
3
• What is Integration?
• Camel… what?
• Honestly… Camel Rox!
• Demo time!
• Questions? Yah… over beer J
Agenda
3.
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
6.
7
• Off the shelf? Home Grown? Acquisition?
• Platforms
• Protocols / Data Formats
• Data Formats
• Timing
• Organizational mismatch
Integration L
7.
8
• Common language!!!!!
• Specific context
• Forces at work
• Concrete solution
• Guidance
• 65 patterns
Patterns FTW!
8.
9
• Protocol mediation
• Routing, Transformation, EIPs
• Start small, build up, ESB if needed
• Open Source
• Community driven
Lightweight integration, right?
9.
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
11.
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
12.
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?
13.
14
Quick Example
File System Message Oriented Middleware
14.
15
Quick Example
From A Send to B
Filter
message
15.
16
Quick Example
from(A) to(B)filter(predicate)
16.
17
Quick Example
from(A) .to(B).filter(isWidget)
19.
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
20.
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(“…”);
21.
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”);
}
}
24.
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!!
25.
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”)
26.
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”);
}
}
33.
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/