You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gallapagus <aa...@adaptris.com> on 2010/06/30 10:24:56 UTC

Multiple Camel Contexts - why?

Hi all,

Just a quick question;
In what scenarios might you might you want/need multiple camel contexts?

Thanks in advance.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Multiple-Camel-Contexts-why-tp512038p512038.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Multiple Camel Contexts - why?

Posted by James Strachan <ja...@gmail.com>.
On 30 June 2010 09:32, Adrian Trenaman <tr...@progress.com> wrote:
> Hi Gallapagus,
>
> In general, you don't tend to want multiple camel contexts in your
> application, if you're running Camel as a standalone Java instance. However,
> if you're deploying Camel routes as OSGi bundles, or WARs in an application
> server, then you can end up having multiple routes being deployed, each in
> it's own, isolated camel context, in the same JVM. This makes sense: you
> want each Camel application to be deployable in isolation, in it's own
> Application Context, and not affected by the other Camel applications.
>
> If you want the endpoints or producers in different camel contexts to
> communicate with another, there are a number of solutions. You can use the
> ServiceMix NMR, or you can use JMS, or you can use Camel's vm transport.

Agreed - one minor nit - the vm transport, only works if Camel is on a
shared class loader across deployment units. So that won't work in
WARs unless camel is on your system classpath & will only work in OSGi
if you are reusing the same version of camel across your bundles.


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Multiple Camel Contexts - why?

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jun 30, 2010 at 10:32 AM, Adrian Trenaman <tr...@progress.com> wrote:
> Hi Gallapagus,
>
> In general, you don't tend to want multiple camel contexts in your
> application, if you're running Camel as a standalone Java instance. However,
> if you're deploying Camel routes as OSGi bundles, or WARs in an application
> server, then you can end up having multiple routes being deployed, each in
> it's own, isolated camel context, in the same JVM. This makes sense: you
> want each Camel application to be deployable in isolation, in it's own
> Application Context, and not affected by the other Camel applications.
>
> If you want the endpoints or producers in different camel contexts to
> communicate with another, there are a number of solutions. You can use the
> ServiceMix NMR, or you can use JMS, or you can use Camel's vm transport.
>

Great answer. I created it as a FAQ entry
https://cwiki.apache.org/confluence/display/CAMEL/Why+use+multiple+CamelContext


> Adrian Trenaman
> http://fusesource.com
>
> On 30/06/2010 09:24, Gallapagus wrote:
>>
>> Hi all,
>>
>> Just a quick question;
>> In what scenarios might you might you want/need multiple camel contexts?
>>
>> Thanks in advance.
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Multiple Camel Contexts - why?

Posted by Gallapagus <aa...@adaptris.com>.
Thanks very much.
That clears that up for me :-)
-- 
View this message in context: http://camel.465427.n5.nabble.com/Multiple-Camel-Contexts-why-tp512038p512048.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Multiple Camel Contexts - why?

Posted by Adrian Trenaman <tr...@progress.com>.
Hi Gallapagus,

In general, you don't tend to want multiple camel contexts in your 
application, if you're running Camel as a standalone Java instance. 
However, if you're deploying Camel routes as OSGi bundles, or WARs in an 
application server, then you can end up having multiple routes being 
deployed, each in it's own, isolated camel context, in the same JVM. 
This makes sense: you want each Camel application to be deployable in 
isolation, in it's own Application Context, and not affected by the 
other Camel applications.

If you want the endpoints or producers in different camel contexts to 
communicate with another, there are a number of solutions. You can use 
the ServiceMix NMR, or you can use JMS, or you can use Camel's vm transport.

Adrian Trenaman
http://fusesource.com

On 30/06/2010 09:24, Gallapagus wrote:
> Hi all,
>
> Just a quick question;
> In what scenarios might you might you want/need multiple camel contexts?
>
> Thanks in advance.
>