You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tai Truong <ma...@gmail.com> on 2012/11/20 11:37:04 UTC

CamelContext behaviour - does a parallel/multiple sendBody() creates new instances of routes and endpoints?

Hi I'm a newbie to Apache Camel and currently evaluating it - though I know Spring Integration and EIP pretty well.

Looking briefly at this example: http://camel.apache.org/walk-through-an-example.html

I wonder what happens when I call the sendBody() in several threads? This is of course a simple example but imagine this flow:

======================================

1. Entrypoint with an adress-and-content message passes:
1.1 an adress message to an "GetEmailBasedOnAdressEndpoint"
1.2 a content messge to an EmailGateway Endpoint

2. GetEmailBasedOnAdressEndpoint gets an email based on an adress and sends an email-adress to the EmailGatewayEndpoint

3. The Email gets both email from one endpoint and content from another endpoint. In case both have been received the gateway is contacted.

======================================

In this case it is important that for each sendBody() it is important creating new endpoints for per thread /service call. This avoids weird behavior and side effects.

Using Spring Integration I used XML configuration defining the an integration service like "SendEmailService". My entrypoint was a factory reading this configuration and each time.

What is standard approach using Apache Camel?

Thanks Tai
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Re: CamelContext behaviour - does a parallel/multiple sendBody() creates new instances of routes and endpoints?

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

I am not sure we follow what you talk about.

I suggest to just play a bit with Camel, then you get a fell of it.
There is plenty of examples, and many good intro blogs / articles from
3rd party sites / people.

See links from here
http://camel.apache.org/articles



On Tue, Nov 20, 2012 at 11:37 AM, Tai  Truong <ma...@gmail.com> wrote:
> Hi I'm a newbie to Apache Camel and currently evaluating it - though I know Spring Integration and EIP pretty well.
>
> Looking briefly at this example: http://camel.apache.org/walk-through-an-example.html
>
> I wonder what happens when I call the sendBody() in several threads? This is of course a simple example but imagine this flow:
>
> ======================================
>
> 1. Entrypoint with an adress-and-content message passes:
> 1.1 an adress message to an "GetEmailBasedOnAdressEndpoint"
> 1.2 a content messge to an EmailGateway Endpoint
>
> 2. GetEmailBasedOnAdressEndpoint gets an email based on an adress and sends an email-adress to the EmailGatewayEndpoint
>
> 3. The Email gets both email from one endpoint and content from another endpoint. In case both have been received the gateway is contacted.
>
> ======================================
>
> In this case it is important that for each sendBody() it is important creating new endpoints for per thread /service call. This avoids weird behavior and side effects.
>
> Using Spring Integration I used XML configuration defining the an integration service like "SendEmailService". My entrypoint was a factory reading this configuration and each time.
>
> What is standard approach using Apache Camel?
>
> Thanks Tai
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen