You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "pmp.martins" <pm...@campus.fct.unl.pt> on 2014/04/04 17:58:50 UTC

Help Understanding Apache Camel main concepts!

I am trying to learn Camel, and so I making an article that explain Camel's
basic notions that a newbie has to know to understand Camel.

For this purpose, I am reading the book Camel in Action, where the authors
define the following main concepts:

- Messages 
- Exchanges
- --------
- Processors?
- Routes?
- -------
- Components
- Endpoints
- Producers 
- Consumers

*Clear notions:*

Now after reading the book I have a clear notion that a Message is an object
with a body, a header and some options, and that an Exchange is an object
that contains two Messages (an In message and an Out Message) along with
some extra information as well.

*Not so clear, probably wrong notions:*

I have the feeling the Processors are nodes that change the content of
Exchanges. I believe that I cannot send a Message object to another endpoint
using Camel, I can only use an Exchange with the InOnly parameter set
(meaning it only has 1 message). 

I also believe that a Route is the junction of a start Endpoint, several
processors, and an end Endpoint where the message is finally received.

*No idea whatsoever:*

As you can probably guess, I am super confused by components, endpoints,
producers and consumers. Like, all I understand is that components are
factories of endpoints and endpoints are factories of producers and
consumers, but I really do not understand how this is suppose to matter to
me nor do I understand how this reflects in code.

I have also visited this discussion:

- http://stackoverflow.com/questions/8845186/what-exactly-is-apache-camel

But it did not help much, as I already learned all I could from it.

Can someone clarify my **not so clear notions** and help me understand the
rest of the concepts? I would be really grateful !



--
View this message in context: http://camel.465427.n5.nabble.com/Help-Understanding-Apache-Camel-main-concepts-tp5749818.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Help Understanding Apache Camel main concepts!

Posted by Claus Ibsen <cl...@gmail.com>.
Hi



On Sun, Apr 6, 2014 at 8:59 PM, pmp.martins
<pm...@campus.fct.unl.pt> wrote:
> So, are my "Not so clear notions" correct?
>
> The explanation about endpoints was clear. An endpoint can either be a
> consumer or a producer. As for components...
>
> Making an analogy, "Components can be seen as houses, and endpoints are the
> doors (if you enter through a door, you are consuming, if you exit then you
> are producing). Would this make sense?
>

I like Jonathans freeway "picture" where the route is the freeway, and
components/endpoints is on and off ramps.
See page 189 and 190 in the Camel in Action book



> Thanks for the help!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Help-Understanding-Apache-Camel-main-concepts-tp5749818p5749862.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Re: Help Understanding Apache Camel main concepts!

Posted by "pmp.martins" <pm...@campus.fct.unl.pt>.
So, are my "Not so clear notions" correct? 

The explanation about endpoints was clear. An endpoint can either be a
consumer or a producer. As for components... 

Making an analogy, "Components can be seen as houses, and endpoints are the
doors (if you enter through a door, you are consuming, if you exit then you
are producing). Would this make sense?

Thanks for the help!



--
View this message in context: http://camel.465427.n5.nabble.com/Help-Understanding-Apache-Camel-main-concepts-tp5749818p5749862.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Help Understanding Apache Camel main concepts!

Posted by "kraythe ." <kr...@gmail.com>.
Endpoints are locations from which input data is consumed or output data is
sent to. So if you call to(endpoint) then you are sending data to that
endpoint. If you have a from(endpoint) you are consuming data produced by
that endpoint. The confusion can be magnified by the fact that we configure
these endpoints via URI with options and often call that an endpoint. It
really is. When it comes to consumers, we are creating an object that
listens to that endpoint in a variety of means. For example with a servlet
endpoint, it will build an exchange whenever a user hits that url with an
HTTP request. ActiveMQ endpoints consume when the queue or topic they are
watching get a new message. However, other endpoints like file endpoints,
have to poll on some timed cadence to detect files. Once a consumer
endpoint has data, the data is converted into an exchange and sent through
the route. A producer will take the exchange, transform it into the
necessary code to communicate with the remote system and then call that
system.

So an endpoint is overloaded to refer to either the remote system
generating the input or taking the output data as well as the camel code
adapts remote systems to the camel route paradigm.

A component is a factory for creating endpoints (either consumers or
producers). When we add a component to a route, we are not actually adding
the consumer or producer but rather a factory. When the camel context is
started and that route is started, the factories are used to build the
actual producers or consumers.

The paradigm is to consume from an endpoint, modify the exchange and then
produce to the destination endpoint.

Hope that helps.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Fri, Apr 4, 2014 at 10:58 AM, pmp.martins
<pm...@campus.fct.unl.pt>wrote:

> I am trying to learn Camel, and so I making an article that explain Camel's
> basic notions that a newbie has to know to understand Camel.
>
> For this purpose, I am reading the book Camel in Action, where the authors
> define the following main concepts:
>
> - Messages
> - Exchanges
> - --------
> - Processors?
> - Routes?
> - -------
> - Components
> - Endpoints
> - Producers
> - Consumers
>
> *Clear notions:*
>
> Now after reading the book I have a clear notion that a Message is an
> object
> with a body, a header and some options, and that an Exchange is an object
> that contains two Messages (an In message and an Out Message) along with
> some extra information as well.
>
> *Not so clear, probably wrong notions:*
>
> I have the feeling the Processors are nodes that change the content of
> Exchanges. I believe that I cannot send a Message object to another
> endpoint
> using Camel, I can only use an Exchange with the InOnly parameter set
> (meaning it only has 1 message).
>
> I also believe that a Route is the junction of a start Endpoint, several
> processors, and an end Endpoint where the message is finally received.
>
> *No idea whatsoever:*
>
> As you can probably guess, I am super confused by components, endpoints,
> producers and consumers. Like, all I understand is that components are
> factories of endpoints and endpoints are factories of producers and
> consumers, but I really do not understand how this is suppose to matter to
> me nor do I understand how this reflects in code.
>
> I have also visited this discussion:
>
> - http://stackoverflow.com/questions/8845186/what-exactly-is-apache-camel
>
> But it did not help much, as I already learned all I could from it.
>
> Can someone clarify my **not so clear notions** and help me understand the
> rest of the concepts? I would be really grateful !
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Help-Understanding-Apache-Camel-main-concepts-tp5749818.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>