View
1.068
Download
0
Category
Preview:
DESCRIPTION
My DevNation 2014 talk, Camel, Fabric8, Devops
Citation preview
2 2
Simplify Enterprise Integration With
Apache Camel and Fuse
Christian Posta Principal Middleware Specialist/Architect
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
5 5
What is Integration?
6
Integration?
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 day
10
11 11
Camel… right?
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?
14
Quick Example
File System Message Oriented Middleware
15
Quick Example
From A Send to B Filter message
16
Quick Example
from(A) to(B) filter(predicate)
17
Quick Example
from(A) .to(B) .filter(isWidget)
18
Quick Example
isWidget = xpath(“/quote/product = ‘widget’”); from(A) .filter(isWidget). to(B)
19 19
Honestly! Camel Rox!
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”); }}
23
<route id=“processOrders”> <from uri=“activemq:orders”/>
<choice> <when> <simple>${header.customer-rating} == ‘gold’</simple> <to uri=“ibmmq:topic:specialCustomer”> </when>
<otherwise> <to uri=“ftp://user@host/orders/regularCustomers” /> </otherwise>
</choice> <log message=“received new order ${body.orderId}”/> <to uri=“ibatis:storeOrder?statementType=Insert”/> </route>
24
• Message Routing • Transformation • Aggregation • Splitting • Resequencer • Routing Slip • Enricher
Enterprise Integration Patterns
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”);
}}
28
•
Management with HawtIO http://hawt.io
29
•
Developer Tooling Support
30
JBoss Fuse Integrate Everything!
Fabric8 (JBoss Fuse + Fabric)
• http://fabric8.io • Simplifies deployments, management • Blurs the line of PaaS • Provides cluster capabilities, coordination • Containers and Profiles • Provides additional management tools for
centralized configuration and monitoring 31
32
Fabric8
33 33
Resources
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/
35
•
Books
36
•
Dzone Refcardz
• Camel Essential Components • http://refcardz.dzone.com/refcardz/essential-camel-components
• Essential EIP with Apache Camel • http://refcardz.dzone.com/refcardz/enterprise-integration
REFCARDZ
37 37
Questions
Consume XML doc from file system, put onto messaging queue,
38
Separately consume from queue, do some routing, archive to file system.
39
Logging, tracing, debugging. Also implement flexibility, HA messaging, scalability.
40
Recommended