Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Apache Camel #1 - Introduction to Apache Camel
Djordje Bajic
Djordje Bajic

Posted on • Edited on

     

Apache Camel #1 - Introduction to Apache Camel

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 200components which can be used out of the box and of course it is written in Java.

On projectofficial 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 otherdsl 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 thislink.

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!

Top comments(3)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
elmuerte profile image
Michiel Hendriks
I shouldn't have written all of those tank programs.
  • Location
    End of line!
  • Education
    MSc
  • Joined

I really like Apache Camel. We've been using it as part of you integration stack, using ServiceMix, for quite some years. I've written quite a few custom components for it. The most extensive one is a AS2 component, it is pretty much feature complete. Although these days there is an official AS2 component, but not as complete as the one I wrote. I should have open-sourced our component. But it was in development limbo for quite a while.

About 2 years ago I started partially embedding Camel in our main application so that users could use a subset of the XML DSL to write some control flows which would execute within the Camel framework. It's working quite well, and features a whole bunch of components which hook into various parts of our main application.

CollapseExpand
 
djoleb profile image
Djordje Bajic
Java backend engineer @Nortal

Hey Michiel!

Thanks for commenting! It's a shame that you didn't use that code to improve Camel codebase. You can try to contact Claus Ibsen, maybe he is willing to look at that code and give it a try in Camel-K or in next Camel release.

Since i am currently implementing Camel in company i work in for all future B2B integrations (transfer data from one app to another and reverse), can you give me some advice, or tell me about some issues you had with it?

We are using camel inside Spring Boot project which is in docker container.

Thanks!

CollapseExpand
 
elmuerte profile image
Michiel Hendriks
I shouldn't have written all of those tank programs.
  • Location
    End of line!
  • Education
    MSc
  • Joined
• Edited on• Edited

The main I had with the AS2 component was that the project for which this was needed was stopped, and for a long time we did not need any AS2 connectivity. After quite some years a new project came along and they needed every feature of the AS2 spec (and even an extension). (Or so they claimed.) So after years I continued with the component.

I did not really have much issue creating this component. The biggest issue is figuring out the best way to set up the stuff correctly in the Camel framework. Writing components is easy if the work to be done is simple input-output, which most work is.

Once you need to implemented a communication protocol which piggy-backs on HTTP, and has an input-output-reply (with optional async reply) things become a bit more difficult.

(Let's hope we don't get a new project which requires RosettaNet, because that component is in worse shape.)

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Java backend engineer @Nortal
  • Joined

More fromDjordje Bajic

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp