What exactly is Apache Camel?

620,388

Solution 1

If you have 5 to 10 minutes, I generally recommend people to read this Integration with Apache Camel by Jonathan Anstey. It's a well written piece which gives a brief introduction to and overview of some of Camel's concepts, and it implements a use case with code samples. In it, Jonathan writes:

Apache Camel is an open source Java framework that focuses on making integration easier and more accessible to developers. It does this by providing:

  • concrete implementations of all the widely used Enterprise Integration Patterns (EIPs)
  • connectivity to a great variety of transports and APIs
  • easy to use Domain Specific Languages (DSLs) to wire EIPs and transports together

There is also a free chapter of Camel in Action (Camel in Action, 2nd ed. is here) which introduces Camel in the first chapter. Jonathan is a co-author on that book with me.

Solution 2

My take to describe this in a more accessible way...

In order to understand what Apache Camel is, you need to understand what are Enterprise Integration Patterns.

Let's start with what we presumably already know: The Singleton pattern, the Factory pattern, etc; They are merely ways of organizing your solution to the problem, but they are not solutions themselves. These patterns were analyzed and extracted for the rest of us by the Gang of Four, when they published their book: Design Patterns. They saved some of us tremendous effort in thinking of how to best structure our code.

Much like the Gang of Four, Gregor Hohpe and Bobby Woolf authored the book Enterprise Integration Patterns (EIP) in which they propose and document a set of new patterns and blueprints for how we could best design large component-based systems, where components can be running on the same process or in a different machine.

They basically propose that we structure our system to be message oriented -- where components communicate with each others using messages as inputs and outputs and absolutely nothing else. They show us a complete set of patterns that we may choose from and implement in our different components that will together form the whole system.

So what is Apache Camel?

Apache Camel offers you the interfaces for the EIPs, the base objects, commonly needed implementations, debugging tools, a configuration system, and many other helpers which will save you a ton of time when you want to implement your solution to follow the EIPs.

Take MVC. MVC is pretty simple in theory and we could implement it without any framework help. But good MVC frameworks provide us with the structure ready-to-use and have gone the extra mile and thought out all the other "side" things you need when you create a large MVC project and that's why we use them most of the time.

That's exactly what Apache Camel is for EIPs. It's a complete production-ready framework for people who want to implement their solution to follow the EIPs.

Solution 3

Creating a project description should not be complicated.

I say:

Apache Camel is messaging technology glue with routing. It joins together messaging start and end points allowing the transference of messages from different sources to different destinations. For example: JMS -> JSON, HTTP -> JMS or funneling FTP -> JMS, HTTP -> JMS, JSON -> JMS

Wikipedia says:

Apache Camel is a rule-based routing and mediation engine which provides a Java object based implementation of the Enterprise Integration Patterns using an API (or declarative Java Domain Specific Language) to configure routing and mediation rules. The domain specific language means that Apache Camel can support type-safe smart completion of routing rules in your IDE using regular Java code without huge amounts of XML configuration files; though XML configuration inside Spring is also supported.

See? That wasn't hard was it?

Solution 4

Camel sends messages from A to B:

enter image description here

Why a whole framework for this? Well, what if you have:

  • many senders and many receivers
  • a dozen of protocols (ftp, http, jms, etc.)
  • many complex rules
    • Send a message A to Receivers A and B only
    • Send a message B to Receiver C as XML, but partly translate it, enrich it (add metadata) and IF condition X, then send it to Receiver D too, but as CSV.

So now you need:

  • translate between protocols
  • glue components together
  • define routes - what goes where
  • filter some things in some cases

Camel gives you the above (and more) out of the box:

enter image description here

with a cool DSL language for you to define the what and how:

  new DefaultCamelContext().addRoutes(new RouteBuilder() {
        public void configure() {
            from("jms:incomingMessages")
                    .choice() // start router rules
                    .when(header("CamelFileName")
                            .endsWith(".xml"))
                    .to("jms:xmlMessages")
                    .when(header("CamelFileName")
                            .endsWith(".csv"))
                    .to("ftp:csvMessages");
}

See also this and this and Camel in Action (as others have said, an excellent book!)

Solution 5

In short:

When there is a requirement to connect / integrate systems, you will probably need to connect to some data source and then process this data to match your business requirements.

In order to do that:

1) You could develop custom program that would do it (might be time consuming and hard to understand, maintain for other developer)

2) Alternatively, you could use Apache Camel to do it in standardised way (it has most of the connectors already developed for you, you just need to set it up and plug your logic - called Process):

Camel will help you to:

  1. Consume data from any source/format
  2. Process this data
  3. Output data to any source/format

By using Apache Camel you will make it easy to understand / maintain / extend your system to another developer.

Apache Camel is developed with Enterprise Integration Patterns. The patterns help you to integrate systems in a good way :-)

Share:
620,388
Myy
Author by

Myy

I'm a Software developer that is barely scratching the surface of the Programing environment. I'm a very nice person and expect the same respect and niceness towards me. I'm mostly posting questions on here, but hopefuly one day I can help more people, just like the people here are helping me out. =)

Updated on October 15, 2021

Comments

  • Myy
    Myy over 2 years

    I don't understand what exactly Camel does.

    If you could give in 101 words an introduction to Camel:

    • What exactly is it?
    • How does it interact with an application written in Java?
    • Is it something that goes together with the server?
    • Is it an independent program?

    Please explain what Camel is.

  • Matt Aldridge
    Matt Aldridge over 12 years
    The Camel in Action book is a very very good book to get to learn the basics and also how to use some of the more complicated features of Camel. I highly recommend it! (I am in no way affiliated with the book or publisher)
  • kuhajeyan
    kuhajeyan over 11 years
    @Clause if want to choose between mule ESB & Camel. what should be my demacation on choosing one ove the other
  • Claus Ibsen
    Claus Ibsen over 11 years
    See some of the links at the comparison to Camels competitors at: camel.apache.org/articles.html.
  • Abbas Gadhia
    Abbas Gadhia almost 11 years
    This is probably the best answer to the question. All the other answers are just as confusing as all the other articles on the internet
  • youri
    youri over 10 years
    Apache Camel homepage refers to this thread... They didn't manage to provide a short functional explanation of their own product.
  • YoYo
    YoYo about 10 years
    This article is a prime example how constructive criticism, and honest effort can create sublime documentation. It is a featured on the official Camel website. But let's keep it constructive, and avoid name tagging. Documentation writers and other contributors are sometimes hard to come by with, and they deserve our respect. BTW - we have many java coding standards ... and stick with it with pride and honor ... how about a documenting standard for media like Wiki's and official Guides?
  • Asad Hasan
    Asad Hasan almost 10 years
    Is it like a fine grain reverse proxy?
  • hutingung
    hutingung almost 10 years
    EIP is the key. If you don't understand EIP, you might use Camel like blind men and elephant(camel). EIP - eaipatterns.com
  • jvhang
    jvhang almost 10 years
    I found this answer via the Camel homepage link. It stupefies me that that they don't quote it directly on their page or even link to the answer in specific.
  • Vijay
    Vijay over 9 years
    Nicely informative on design patterns perceptive.Thank you.
  • lowLatency
    lowLatency over 9 years
    +50 for this answer - starting with intro to EIP and analogy it with GOF and MVC & frameworks. As from the question, it looks OP don't have idea of EIP. I was in the same boat, before reading this answer
  • EMM
    EMM over 9 years
    Now, this is what I call crisp and to the point answer. Strangely, the accepted answer looks like an advertisement. +1
  • JavaTechnical
    JavaTechnical over 9 years
    That means other developers can change the logic in another programming language too?
  • Azkuma
    Azkuma about 9 years
    This description should be added to the Apache Camel homepage as it answers the question and then some. Exactly as to his use of analogy with the MVC being handwritten or by use of a 'tool' to assist in doing this answer has given me an understanding without having to trawl through endless other (useful) links when all that is needed was this succinct answer.
  • Dheeraj Bhaskar
    Dheeraj Bhaskar about 9 years
    @JavaTechnical given the messaging pattern (EIP), you already can code different components in different languages because these messages are in language independent formats like JSON. Camel provides an easy framework to implement EIP. This is based on my understanding. Please correct me if I'm mistaken.
  • Admin
    Admin over 8 years
    "They basically propose that we structure our system to be message oriented -- where components communicate with each others using messages as inputs and outputs and absolutely nothing else. "..This line clarified everything. Excellent answer
  • Quan Nguyen
    Quan Nguyen over 7 years
    A little bit EIP problems: "There have been many libraries and frameworks over the years to help with inte- gration. But frequently the concepts behind the Enterprise Integration Patterns get transformed into some complex class hierarchies or objects that need to be wired together just so, and the original intentions and patterns are often lost. The developer is forced from then on to focus on the low-level detail and some complex class library API, losing the bigger picture and patterns."
  • Dave
    Dave about 7 years
    "Most "new" things in computing aren't really new at all, they're just a mystifying wrapper around something already well-understood." <<<< Best thing I've read all week!
  • Ashish Burnwal
    Ashish Burnwal over 6 years
    This ans has helped me to understand the very basics of Apache Camel. Thanks a lot for such a valuable article :)
  • Stijn de Witt
    Stijn de Witt over 6 years
    Documentation writers and other contributors are sometimes hard to come by When will developers learn that writing docs is part of development and not some side activity that 'other people' should do?? Besides, we are talking about the project description that goes on the homepage here! This attitude that many Apache projects exhibit is the reason I mostly avoid Apache projects these days. If they can't be bothered to provide a simple description of their own project on their own project homepage what does that tell me?
  • Stijn de Witt
    Stijn de Witt over 6 years
    It's 2017 now and in 3 years time all they did was add an acknowledgement that their own description is buzzword soup and add a link to this thread. They didn't even take the time to add a summary of this thread (or even just copy-paste some stuff) to the page itself. All we get is a link to SO. Come on, at some point you gotta stop defending such attitude.
  • ankush981
    ankush981 over 6 years
    So, it can be used to connect, say, microservices?
  • Claus Ibsen
    Claus Ibsen over 6 years
    Yes absolutely it can be used for connecting microservices, its after all just a little Java toolkit/framework. The Camel in Action 2nd edition book has a full chapter on Camel microservices.
  • Jose Quinteiro
    Jose Quinteiro almost 6 years
    What are "Enterprise Integration Patterns (EIPs)" you ask? All you have to do to find out is "Buy the book Enterprise Integration Patterns..."
  • Stimpson Cat
    Stimpson Cat over 5 years
    Great explanation nice to read and easy to remember. I wonder what role has a runway or pilot, if they even exist in camel.
  • Ankur Nirmalkar
    Ankur Nirmalkar almost 5 years
    Nice explanation specially Airport example keep it up. if you added few more extended terms and little bit piece of code example would be really great !! Thanks
  • Amin
    Amin over 4 years
    This is a nice explanation...simple, concise and useful.
  • YaaKouB
    YaaKouB over 4 years
    Camel implement 40 pattern, in EIP : enterprise integration pattern.
  • Krzysztof Tomaszewski
    Krzysztof Tomaszewski over 4 years
    I wonder why do you use the word "lightweight". My observation is that Apache Camel is actually heavy.
  • tjeubaoit
    tjeubaoit over 3 years
    Many thanks, that is best explanation that I have ever seen. The only one that helped me understand the concepts of Apache Camel.
  • Gerold Broser
    Gerold Broser over 3 years
  • Gerold Broser
    Gerold Broser over 3 years
    "implements all Enterprise Integration patterns" is not correct: Because Camel implements many of the design patterns in the EIP book.
  • Gerold Broser
    Gerold Broser over 3 years
    "implements all Enterprise Integration patterns" is not correct: Because Camel implements many of the design patterns in the EIP book.
  • WesternGun
    WesternGun about 3 years
    So Camel is a bottle of glue whose main ingredient is DSL based of EIPs.
  • Peter V. Mørch
    Peter V. Mørch almost 3 years
    The images in the "Integration with Apache Camel" article no longer work. Here is a link to an archived version where the images work: web.archive.org/web/20171029104103/https://dzone.com/article‌​s/…
  • anotherDev
    anotherDev about 2 years
    As a noob, this is the only answer on this page that made any kind of sense to me in understanding what Camel does. Thanks.
  • Martin
    Martin almost 2 years
    This is confusing to me. Design patterns, as I understood the literature, are meant for reasoning and guiding software design in an abstract way focusing on problem-context-solution triplets. But's a catalogue of components for EIPs?