Apache Camel #1 - Introduction to Apache Camel
Djordje Bajic
Posted on May 25, 2019
Hello World!
This is my first post so I decided to write about the framework I use a lot in the last couple of months.
Apache Camel is a very powerful integration framework, it is used as a mediation engine between two systems, it has a great community, large codebase with over 200 components which can be used out of the box and of course it is written in Java.
On project official website you can find documentation and all info about releases.
Camel Context
Context is a heart of camel applications and it represents runtime system.
Camel Route
Sample route:
Explanation:
As you probably noticed class Route extends the RouteBuilder class, from which you will override configuration and write your route in it.
I used JavaDsl in this route, you can use any other dsl that camel supports.
errorHandler(deadLetterChannel("mock:errorRoute")) - This is error handler for this particular route, if any exception occurs message will be sent to deadletter mock queue "errorRoute".
from("timer:timerName?period=5000") - "from" is like an endpoint in camel context. In this particular case, it is timer component(scheduler) which will trigger route execution every 5 seconds, timer name is "timerName". You can check more about that on this link.
log("Route started!") - this is a camel's log component which will print text in console.
to("mock:anotherRouter") - "to" represents on which endpoint, queue or route message will be sent. "mock:anotherRoute" represents a mock queue on which message will be sent.
These are the most basic things about Camel.
If you are interested in learning a little more about Apache Camel feel free to contact me here or on gitter -> @djoleb.
Thanks!
Posted on May 25, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.