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
<[email protected]>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.
>

Reply via email to