Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Exploring Apache Camel           Vitalii Tymchyshyn             tivv00@gmail.com                     @tivv00
Typical IoC application                     Container             Filters                     MVC framework           View...
Typical IoC application        This is your call stack:everyones busy processing the request!
Camel application                                Consumers                                (e.g. Jetty)                    ...
Camel application  Everyones doing its workConveyor is provided by Camel
Some camel ext connectors●   HTTP (Jetty, Client v3, Client v4, GAE, Servlet)●   MQ (AMQP, ActiveMQ, ZeroMQ, MQTT, SQS)●  ...
EIP patterns        A       BD                    E!?   1       2   3                           C
Main camel primitives                       Context    Component                     RouteBuilder     Endpoint            ...
Camel RegistryCamel supports components lookup with plugablemechanism named Registry.Next registry types are supported out...
Camel DSLs    Camel routes can be expressed in next    DSLs:✔   Java / Groovy /Scala / Kotlin (WiP)✔   Spring XML / Bluepr...
Adding own code     You can write your own component /     endpoint / consumer / producer ➔   Good when you are developing...
Reusing routes➔   You can use                             <route>                                              ...    “dir...
Handling exceptions    You can define exception handling directly in    camel routes. It can:●   Use different strategies ...
Monitoring your routes    Camel automatically gathers statistics on your    routes and provides it with JMX.    Statistics...
Questions? Suggestions?
Upcoming SlideShare
Loading in …5
×

Exploring Apache Camel

1,892 views

Published on

Introduction to Apache Camn

  • Be the first to comment

Exploring Apache Camel

  1. 1. Exploring Apache Camel Vitalii Tymchyshyn tivv00@gmail.com @tivv00
  2. 2. Typical IoC application Container Filters MVC framework Views Controller Controller ControllerEXT Service Service Service DAO DAO DAO
  3. 3. Typical IoC application This is your call stack:everyones busy processing the request!
  4. 4. Camel application Consumers (e.g. Jetty) CamelFilters Controllers Services DAOs Views EXT
  5. 5. Camel application Everyones doing its workConveyor is provided by Camel
  6. 6. Some camel ext connectors● HTTP (Jetty, Client v3, Client v4, GAE, Servlet)● MQ (AMQP, ActiveMQ, ZeroMQ, MQTT, SQS)● DB (JPA, DynamoDB, SimpleDB, CouchDB, Hazelcast, Hbase, iBatis, JDBC, MongDB, Zookeeper, Hibernate)● BLOB (File, HDFS, FTP, SCP, S3)● RPC (CXF, RMI, Avro, SSH, JGroups)● ...
  7. 7. EIP patterns A BD E!? 1 2 3 C
  8. 8. Main camel primitives Context Component RouteBuilder Endpoint RouteDefinitionProducer / Consumer Route Exchange
  9. 9. Camel RegistryCamel supports components lookup with plugablemechanism named Registry.Next registry types are supported out of box:● Simple — simple map-based● JNDI — looks up objects in JNDI● ApplicationContext — looks up objects in SpringThis means that Camel easily intergrates with Spring forcomplex components assembling and configuration
  10. 10. Camel DSLs Camel routes can be expressed in next DSLs:✔ Java / Groovy /Scala / Kotlin (WiP)✔ Spring XML / Blueprint XML✔ Annotations Spring example <route> Java example <from uri="test-jms:queue:test.queue"/>from("test-jms:queue:test.queue") <to uri="file://test"/> .to("file://test"); </route>
  11. 11. Adding own code You can write your own component / endpoint / consumer / producer ➔ Good when you are developing reusable component, need advanced features or making a consumer Or simply call a POJO ➔ When you simply need some logic<bean id=”myService” class=”MyService”/><route> <from uri="servlet:callMyService"/> public class MyService { <unmarshall><jaxb .../></unmarshall> Answer process(Request arg) { <to uri="bean:myService"/> ... <marshall><jaxb .../></marshall> }</route> }
  12. 12. Reusing routes➔ You can use <route> ... “direct” component <to uri="direct:save"/> ... to call routes from </route> another routes or your code. <route> <from uri="direct:save"/> <to uri="file://test"/>➔ Use direct-vm to </route> call routes from another context @EndpointInject(uri = "direct:save") ProducerTemplate saveRoute; ... SaveRoute.sendBody(“testBody”);
  13. 13. Handling exceptions You can define exception handling directly in camel routes. It can:● Use different strategies based on exception class● Perform automatic retries (redeliveries)● Call “exceptional” route● Define “continue” or “stop route” handlers
  14. 14. Monitoring your routes Camel automatically gathers statistics on your routes and provides it with JMX. Statistics is:● Enabled by default● Provides detailed statistics up to single endpoint level● Has timings and success/failure counters● Can be retrieved as a single XML file for the route or the whole context
  15. 15. Questions? Suggestions?

×