apache camel introduction & what's in the box
TRANSCRIPT
![Page 1: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/1.jpg)
Apache Camel Introduction
& What's in the box
Claus Ibsen @davsclaus
![Page 2: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/2.jpg)
Claus Ibsen• Principal Software Engineer at Red Hat
• Apache Camel
• 8 years working with Camel
• Author of Camel in Action books
@davsclaus davsclaus.com
![Page 3: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/3.jpg)
Agenda• What is Apache Camel?
• Little Example
• Trying Apache Camel
• What's in the Camel Box?
• Running Camel
• More Information
![Page 4: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/4.jpg)
What is Apache Camel?• Quote from the website
Apache Camel is a powerful Open Source Integration Framework
based on Enterprise Integration Patterns
![Page 5: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/5.jpg)
What is Apache Camel?• Quote from the website
Apache Camel is a powerful Open Source Integration Framework
based on Enterprise Integration Patterns
![Page 6: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/6.jpg)
Integration Framework
![Page 7: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/7.jpg)
Enterprise Integration Patterns
![Page 8: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/8.jpg)
Enterprise Integration Patterns
![Page 9: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/9.jpg)
Content Based Router
![Page 10: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/10.jpg)
Content Based Router
from newOrder
![Page 11: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/11.jpg)
Content Based Router
from newOrder choice
![Page 12: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/12.jpg)
Content Based Router
from newOrder choice when isWidget to widget
![Page 13: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/13.jpg)
Content Based Router
from newOrder choice when isWidget to widget otherwise to gadget
![Page 14: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/14.jpg)
Content Based Router
from(newOrder) choice when(isWidget) to(widget) otherwise to(gadget)
![Page 15: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/15.jpg)
Content Based Router
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
![Page 16: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/16.jpg)
Content Based Router
Endpoint newOrder = endpoint("activemq:queue:newOrder");
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
![Page 17: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/17.jpg)
Content Based Router
Endpoint newOrder = endpoint("activemq:queue:newOrder");Predicate isWidget = xpath("/order/product = 'widget'");
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
![Page 18: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/18.jpg)
Content Based Router
Endpoint newOrder = endpoint("activemq:queue:newOrder");Predicate isWidget = xpath("/order/product = 'widget'");Endpoint widget = endpoint("activemq:queue:widget");Endpoint gadget = endpoint("activemq:queue:gadget");
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget);
![Page 19: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/19.jpg)
Java Code
public void configure() throws Exception { Endpoint newOrder = endpoint("activemq:queue:newOrder"); Predicate isWidget = xpath("/order/product = 'widget'"); Endpoint widget = endpoint("activemq:queue:widget"); Endpoint gadget = endpoint("activemq:queue:gadget");
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget); }
![Page 20: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/20.jpg)
Java Codeimport org.apache.camel.Endpoint;import org.apache.camel.Predicate;import org.apache.camel.builder.RouteBuilder;
public class MyRoute extends RouteBuilder {
public void configure() throws Exception { Endpoint newOrder = endpoint("activemq:queue:newOrder"); Predicate isWidget = xpath("/order/product = 'widget'"); Endpoint widget = endpoint("activemq:queue:widget"); Endpoint gadget = endpoint("activemq:queue:gadget");
from(newOrder) .choice() .when(isWidget).to(widget) .otherwise().to(gadget); }}
![Page 21: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/21.jpg)
Java DSLimport org.apache.camel.builder.RouteBuilder;
public class MyRoute extends RouteBuilder {
public void configure() throws Exception { from("activemq:queue:newOrder") .choice() .when(xpath("/order/product = 'widget'")) .to("activemq:queue:widget") .otherwise() .to("activemq:queue:gadget"); }}
![Page 22: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/22.jpg)
XML DSL<route> <from uri="activemq:queue:newOrder"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:queue:widget"/> </when> <otherwise> <to uri="activemq:queue:gadget"/> </otherwise> </choice> </route>
![Page 23: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/23.jpg)
Endpoint URIs<route> <from uri="file:inbox/orders"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:queue:widget"/> </when> <otherwise> <to uri="activemq:queue:gadget"/> </otherwise> </choice> </route>
Use file instead
![Page 24: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/24.jpg)
Endpoint URIs<route> <from uri="file:inbox/orders?delete=true"/> <choice> <when> <xpath>/order/product = 'widget'</xpath> <to uri="activemq:queue:widget"/> </when> <otherwise> <to uri="activemq:queue:gadget"/> </otherwise> </choice> </route>
Parameters
![Page 25: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/25.jpg)
Just Java Code
![Page 26: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/26.jpg)
Camel Java Tooling
Camel Forge
![Page 27: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/27.jpg)
Just XML
![Page 28: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/28.jpg)
Camel XML Tooling
![Page 29: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/29.jpg)
Camel XML Tooling
http://tools.jboss.org/features/apachecamel.html
![Page 30: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/30.jpg)
Architecture
![Page 31: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/31.jpg)
Componentsahc bindy coap docker
ahc-ws blueprint cometd dozerapns boon context dropbox
atmosphere box couchdb eclipseatom cache crypto ejbaws cassandraql csv elasticsearchbam castor cfx elsql
bean-validator cdi cxf-transport eventadminbeanio chunk disruptor exec
beanstalk cmis dns facebook
![Page 32: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/32.jpg)
Componentsflatpack google-drive hbase jacksonxml
fop google-mail hdfs jasyptfreemarker gora hdfs2 javaspace
ftp grape http jaxbgae groovy http4 jbpm
ganglia gson ibatis jcloudsgeocoder guava-eventbus ical jcr
git guice infinispan jdbcgithub hawtdb irc jetty8
google-calendar hazelcast jackson jetty9
![Page 33: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/33.jpg)
Componentsjgroups jsonpath leveldb mustache
jibx jt400 linkedin mveljing juel lucene mybatisjira jxpath mail nettyjms kafka metrics netty-httpjmx kestrel mina netty4jolt krati mina2 netty4-http
josql kubernetes mongodb ognljpa kura mqtt olingo2jsch ldap msv openshift
![Page 34: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/34.jpg)
Componentsoptaplanner rabbitmq scala smpp
paho restlet schematron snpppaxlogging rmi scr soap
pdf routebox script solrpgevent rss servlet spark-restprinter ruby servletlistener spring
protobuf rx shiro spring-batchquartz salesforce sip spring-bootquarz2 sap-netweaver sjms spring-integrationquickfix saxon slack spring-javaconfig
![Page 35: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/35.jpg)
Componentsspring-ldap swagger undertow xmlsecurityspring-redis swagger-java univocity xmpp
spring-security syslog urlrewrite xstreamspring-ws tagsoup velocity yammer
sql tarfile vertx zipfilessh test weather zookeeperstax test-blueprint websocket
stomp test-spring xmlbeansstream testng xmljson
stringtemplate twitter xmlrpc
![Page 36: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/36.jpg)
![Page 37: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/37.jpg)
+
![Page 38: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/38.jpg)
+
+
![Page 39: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/39.jpg)
+
+
+
![Page 40: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/40.jpg)
+
+
+ =
![Page 41: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/41.jpg)
Agenda• What is Apache Camel?
• Little Example
• Trying Apache Camel
• What's in the Camel Box?
• Running Camel
• More Information
![Page 42: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/42.jpg)
File Copier Example
![Page 43: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/43.jpg)
Public Static Void Main
![Page 44: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/44.jpg)
Create CamelContext
![Page 45: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/45.jpg)
Add RouteBuilder
![Page 46: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/46.jpg)
Java DSL
![Page 47: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/47.jpg)
Start / Stop
![Page 48: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/48.jpg)
Camel Main
![Page 49: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/49.jpg)
Agenda• What is Apache Camel?
• Little Example
• Trying Apache Camel
• What's in the Camel Box?
• Running Camel
• More Information
![Page 50: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/50.jpg)
Trying Camel• Download Apache Camel 2.16.2
• tar xf apache-camel-2.16.2.tar.gz • cd apache-camel-2.16.2 • cd examples
read readme.md first
![Page 51: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/51.jpg)
Beginner Example• camel-example-console
mvn camel:run
![Page 52: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/52.jpg)
Run with web console
mvn io.hawt:hawtio-maven-plugin:1.4.60:camel
http://hawt.io/maven
![Page 53: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/53.jpg)
Widget & Gadget Example• camel-example-widget-gadget-xml
bin/activemq console mvn exec:java
There is a Java
example also
Requires ActiveMQ running
![Page 54: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/54.jpg)
Agenda• What is Apache Camel?
• Little Example
• Trying Apache Camel
• What's in the Camel Box?
• More Information
![Page 55: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/55.jpg)
What's in the Camel Box?
![Page 57: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/57.jpg)
Pipes and Filters EIP
from("file:inbox") .pipeline() .to("bean:decrypt") .to("bean:authenticate") .to("bean:de-dup");
![Page 58: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/58.jpg)
Pipes and Filters EIP
from("file:inbox") .to("bean:decrypt") .to("bean:authenticate") .to("bean:de-dup");
pipeline is default mode so its nearly always omitted
![Page 59: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/59.jpg)
Recipient List
from("reslet:http://localhost:9080 /stocks/{symbol}?restletMethods=post") .recipientList(simple("activemq:queue:${header.symbol}"));
curl -X POST -d "120" "http://localhost:9080/stock/ORCL"
![Page 60: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/60.jpg)
Recipient List
from("reslet:http://localhost:9080 /stocks/{symbol}?restletMethods=post") .recipientList(simple("activemq:queue:${header.symbol}"));
curl -X POST -d "120" "http://localhost:9080/stock/ORCL"
![Page 61: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/61.jpg)
Recipient List
from("reslet:http://localhost:9080 /stocks/{symbol}?restletMethods=post") .toD("activemq:queue:${header.symbol}"));
much easier now with toD (to dynamic)
curl -X POST -d "120" "http://localhost:9080/stock/ORCL"
![Page 62: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/62.jpg)
Recipient List
restConfiguration().component("restlet").port(9080); rest("stocks") .post("{symbol}") .toD("activemq:queue:${header.symbol}"));
and use rest-dsl
curl -X POST -d "120" "http://localhost:9080/stock/ORCL"
![Page 63: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/63.jpg)
Splitter
![Page 64: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/64.jpg)
Splitter
from("file:inbox")
![Page 65: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/65.jpg)
Splitter
from("file:inbox") .split(body().tokenize("\n"))
![Page 66: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/66.jpg)
Splitter
from("file:inbox") .split(body().tokenize("\n")) .marshal(customToXml)
Custom Data Format
![Page 67: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/67.jpg)
Splitter
from("file:inbox") .split(body().tokenize("\n")) .marshal(customToXml) .to("activemq:line");
Custom Data Format
![Page 68: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/68.jpg)
Componentsahc bindy coap docker
ahc-ws blueprint cometd dozerapns boon context dropbox
atmosphere box couchdb eclipseatom cache crypto ejbaws cassandraql csv elasticsearchbam castor cfx elsql
bean-validator cdi cxf-transport eventadminbeanio chunk disruptor exec
beanstalk cmis dns facebook
camel-catalog:component-list | wc -l 207
![Page 69: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/69.jpg)
Data Formatsavro flatpack pgp univocity-fixed
barcode gzip protobuf univocity-tsvbase64 hl7 rss xmlBeansbeanio ical secureXML xmjson
bindy-csv jacksonxml serialization xmlrpcbindy-fixed jaxb soapjaxb xstreambindy-kvp jibx string zip
boon json-gson syslog zipfilecastor json-jackson tarfilecrypto json-xstream tidyMarkup
csv mime-multipart univocity-csv
camel-catalog:dataformat-list | wc -l 41
![Page 70: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/70.jpg)
Data Format with JAXB• POJO class with @JAXB annotations
![Page 71: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/71.jpg)
Data Format with JAXB• marshal (xml -> pojo) • unmarshal (pojo -> xml)
![Page 72: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/72.jpg)
Languagesbean header php sql
constant javaScript python terser
el jsonpath ref tokenize
exchangeProperty jxpath ruby xpath
file mvel simple xquery
groovy ognl spel xtokenize
camel-catalog:language-list | wc -l 24
![Page 73: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/73.jpg)
Language w/ Simple
![Page 74: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/74.jpg)
Language w/ Groovyhere you can do groovy
programming
![Page 75: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/75.jpg)
Camel DSLs
• Java DSL
• XML DSL (spring or OSGi blueprint)
• Groovy DSL
• Scala DSL
Groovy and Scalaare not much in use
![Page 76: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/76.jpg)
Type Converters
DefaultTypeConverter INFOLoaded 183 type converters
![Page 77: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/77.jpg)
Type Converters• Camel provides
type convertersfor most commontypes in Java
hawtio can list the converters
![Page 78: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/78.jpg)
Type Convertersexplicit type conversion
using convertBodyTo
![Page 79: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/79.jpg)
Type Convertersimplicit type conversion
Camel will automatic convert from
java.io.File to String
![Page 80: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/80.jpg)
Writing customType Converter
META-INF/services/org/apache/camel/TypeConverter com.acme.MyTypeConverter
![Page 81: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/81.jpg)
Property Placeholders• Externalize configuration
myapp.properties
hi=Hello port=9090 myQueueName=greeting
![Page 82: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/82.jpg)
• Camel PropertyPlaceholder
Property Placeholders
![Page 83: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/83.jpg)
Property Placeholders• Bridge with Spring Property Placeholder
Spring: ${xxx} Camel: {{xxx}}
![Page 84: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/84.jpg)
ProducerTemplate• Client API (alike Spring Templates)
Send a message to any Camel endpoint
![Page 85: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/85.jpg)
ProducerTemplate• Client API (alike Spring Templates)
FTP serverJava Application
How to upload a file to a FTP server from Java code
![Page 86: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/86.jpg)
ProducerTemplate
FTP serverJava Application
![Page 87: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/87.jpg)
Test Kit
camel-test camel-test-blueprint
camel-test-spring camel-testng
camel-test-cdi in the works
![Page 88: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/88.jpg)
camel-test
![Page 89: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/89.jpg)
camel-test easy to run or debug
![Page 90: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/90.jpg)
camel-test1) set expectations
![Page 91: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/91.jpg)
camel-test1) set expectations
2) send message(s)
![Page 92: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/92.jpg)
camel-test1) set expectations
2) send message(s)
3) assert
![Page 93: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/93.jpg)
camel-test-spring
Notice the extends
![Page 94: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/94.jpg)
Testing 'Production' Routes
how to test route without any mock endpoints ?
![Page 95: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/95.jpg)
MockAndSkipmock and skip sending to the target endpoint
TIP you can also use wildcards and not skip
mock: added as prefix
![Page 96: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/96.jpg)
AdviceWithenable
adviceWith
add mock endpoint last
start Camel after adviceWith
![Page 97: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/97.jpg)
NotifyBuilderBlackbox testing the
'production' route
![Page 98: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/98.jpg)
NotifyBuilder
![Page 99: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/99.jpg)
NotifyBuilder1) set expectations
2) send message(s)
3) assert
![Page 100: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/100.jpg)
Management• JMX
![Page 101: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/101.jpg)
Management• REST (w/ Jolokia)
jolokia/exec/org.apache.camel:context=camel,type=context,
name="camel"/dumpRoutesAsXml()
![Page 102: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/102.jpg)
hawtio uses Jolokia
http://hawt.io/
![Page 103: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/103.jpg)
Management• Java API
![Page 104: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/104.jpg)
• Control Bus
Managementto stop a route from a route
![Page 105: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/105.jpg)
Inflight Repository• Track messages during routing
![Page 106: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/106.jpg)
• Reliable Shutdown
Graceful Shutdown
Route A
Route B
Route C
2
1
3 4
5
6
Startup Shutdown
Stop accept new messages
Complete current inflight messages
![Page 107: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/107.jpg)
Camel Commands• Apache Karaf / JBoss Fuse
![Page 108: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/108.jpg)
Camel Commands• Spring Boot
![Page 109: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/109.jpg)
Camel Commands• fabric8-forge
![Page 110: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/110.jpg)
Rest DSL
use REST verbs to define services that becomes Camel routes
![Page 111: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/111.jpg)
Rest DSL
configure REST and turn on swagger api
![Page 112: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/112.jpg)
Rest DSL
cd examples/camel-example-swagger-java mvn jetty:run
![Page 113: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/113.jpg)
Rest DSL
swagger doc as json schema
![Page 114: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/114.jpg)
Rest DSL
embedded swagger-ui
![Page 115: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/115.jpg)
Error Handling
![Page 116: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/116.jpg)
Error Handling
![Page 117: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/117.jpg)
Error Handling
![Page 118: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/118.jpg)
Error Handling
![Page 119: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/119.jpg)
Maven Tooling• Archetypes
camel-archetype-java camel-archetype-componentcamel-archetype-spring camel-archetype-api-component
camel-archetype-web camel-archetype-dataformat
camel-archetype-cdi
camel-archetype-spring-boot camel-archetype-scalacamel-archetype-blueprint camel-archetype-groovy
camel-archetype-spring-dm
camel-archetype-scr
![Page 120: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/120.jpg)
Maven Tooling• camel-maven-plugin
mvn camel:run
![Page 121: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/121.jpg)
Maven Tooling• fabric8-camel-maven-plugin
mvn fabric8-camel:validate
http://fabric8.io/guide/camelMavenPlugin.html
Validate your Camel uris
from the source
![Page 122: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/122.jpg)
All the other stuff• Transactions
• Interceptors
• Security
• Thread Management
• Route Policy
• Reactive Asynchronous Routing Engine
• POJO Routing
• Debugging and Tracing
![Page 123: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/123.jpg)
Agenda• What is Apache Camel?
• Little Example
• Trying Apache Camel
• What's in the Camel Box?
• Running Camel
• More Information
![Page 124: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/124.jpg)
Running CamelStandalone Web Application
Camel Spring XML JEE Application
Camel Spring Boot Apache Karaf (OSGi)
Camel CDI Wildfly(wildfly-camel)
Camel Guice vert.x (vertx-camel)
![Page 125: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/125.jpg)
Running Camel
Just need a Java Runtime
![Page 126: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/126.jpg)
Running Camel
![Page 127: Apache Camel Introduction & What's in the box](https://reader031.vdocuments.net/reader031/viewer/2022020411/587081201a28ab57368b6647/html5/thumbnails/127.jpg)
More Information• My blog
• http://www.davsclaus.com • Apache Camel 3rd party blogs/articles/etc
• http://camel.apache.org/articles • Camel videos
• https://vimeo.com/tag:apachecamel • Best What is Camel article
• https://dzone.com/articles/open-source-integration-apache • Free chapter 1 covers Camel concepts to learn
• http://manning.com/ibsen/chapter1sample.pdf
@davsclaus davsclaus.com