You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Andrei Shakirin <as...@talend.com> on 2011/09/23 09:46:10 UTC

Best practices to communicate between Camel Contexts in different OSGi bundles

Hi,

I would like to ask what is the best practice to establish communication between two Camel contexts deployed in a different bundles in OSGi environment.

Actually I see the following ways:

A) VM component.
    Declare and deploy different contexts and provide communication using "vm:"
   Disadvantage: VM designed for async communication and creates new threads for consuming messages that not always desired. Addition settings for VM is necessary to get synchronious response.

B) JMS component.
    The same as (A) but uses JMS component
   Disadvantage: JMS produces overhead that is not always desired.

C) Share Camel Context as OSGi Service and provide communication using "direct:"
     Expose Camel Context as OSGi service, get it in other bundles and add the routes. Use "direct:" for communication.
     Disadvantage: have no idea how use this approach with Spring routes configuration

D) Expose routes as OSGi services
      Each route is exposed as OSGi service and uses the producerTemplate to kick off the route when another bundle invokes on the service.
     Disadvantage: requires additional code to expose and invoke the routes

E) Share Spring context via "<import resource>"
      One bundle exports spring configuration as resource, another one imports it in Spring configuration. Spring and Camel context are shared.
     Disadvantage: import resources is not the best OSGi practice, bundles are staying coupled

Do you prefer one of proposed ways or there is a different one?

Regards,
Andrei.

Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Freeman Fang <fr...@gmail.com>.
Hi

JBI is, but it's not the case for NMR, NMR isn't bind to XML payload,  
nor need a  WSDL to describe the NMR endpoint interface, this is the  
big difference with JBI

Freeman
On 2011-9-23, at 下午4:17, Andrei Shakirin wrote:

> Hi Freeman,
>
> yep, it is also the possibility.
> However JBI & NMR uses the WSDL routing semantics and mandates XML  
> payloads, that is not always desired.
>
> Regards,
> Andrei.
>
> -----Original Message-----
> From: Freeman Fang [mailto:freeman.fang@gmail.com]
> Sent: 23 September 2011 09:56
> To: users@camel.apache.org
> Subject: Re: Best practices to communicate between Camel Contexts in  
> different OSGi bundles
>
> Hi,
>
> Another solution is use camel-nmr(camel nmr component is from Apache
> Servicemix) endpoint, you may need take a look at[1] to get more  
> details.
> [1]http://camel.apache.org/nmr.html
>
> Freeman
> On 2011-9-23, at 下午3:46, Andrei Shakirin wrote:
>
>> Hi,
>>
>> I would like to ask what is the best practice to establish
>> communication between two Camel contexts deployed in a different
>> bundles in OSGi environment.
>>
>> Actually I see the following ways:
>>
>> A) VM component.
>>   Declare and deploy different contexts and provide communication
>> using "vm:"
>>  Disadvantage: VM designed for async communication and creates new
>> threads for consuming messages that not always desired. Addition
>> settings for VM is necessary to get synchronious response.
>>
>> B) JMS component.
>>   The same as (A) but uses JMS component
>>  Disadvantage: JMS produces overhead that is not always desired.
>>
>> C) Share Camel Context as OSGi Service and provide communication  
>> using
>> "direct:"
>>    Expose Camel Context as OSGi service, get it in other bundles and
>> add the routes. Use "direct:" for communication.
>>    Disadvantage: have no idea how use this approach with Spring
>> routes configuration
>>
>> D) Expose routes as OSGi services
>>     Each route is exposed as OSGi service and uses the
>> producerTemplate to kick off the route when another bundle invokes on
>> the service.
>>    Disadvantage: requires additional code to expose and invoke the
>> routes
>>
>> E) Share Spring context via "<import resource>"
>>     One bundle exports spring configuration as resource, another one
>> imports it in Spring configuration. Spring and Camel context are
>> shared.
>>    Disadvantage: import resources is not the best OSGi practice,
>> bundles are staying coupled
>>
>> Do you prefer one of proposed ways or there is a different one?
>>
>> Regards,
>> Andrei.
>
> ---------------------------------------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
>
>
>
>
>
>
>
>
>

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










RE: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Andrei Shakirin <as...@talend.com>.
Hi Freeman,

yep, it is also the possibility.
However JBI & NMR uses the WSDL routing semantics and mandates XML payloads, that is not always desired.

Regards,
Andrei.

-----Original Message-----
From: Freeman Fang [mailto:freeman.fang@gmail.com] 
Sent: 23 September 2011 09:56
To: users@camel.apache.org
Subject: Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Hi,

Another solution is use camel-nmr(camel nmr component is from Apache
Servicemix) endpoint, you may need take a look at[1] to get more details.
[1]http://camel.apache.org/nmr.html

Freeman
On 2011-9-23, at 下午3:46, Andrei Shakirin wrote:

> Hi,
>
> I would like to ask what is the best practice to establish 
> communication between two Camel contexts deployed in a different 
> bundles in OSGi environment.
>
> Actually I see the following ways:
>
> A) VM component.
>    Declare and deploy different contexts and provide communication 
> using "vm:"
>   Disadvantage: VM designed for async communication and creates new 
> threads for consuming messages that not always desired. Addition 
> settings for VM is necessary to get synchronious response.
>
> B) JMS component.
>    The same as (A) but uses JMS component
>   Disadvantage: JMS produces overhead that is not always desired.
>
> C) Share Camel Context as OSGi Service and provide communication using 
> "direct:"
>     Expose Camel Context as OSGi service, get it in other bundles and 
> add the routes. Use "direct:" for communication.
>     Disadvantage: have no idea how use this approach with Spring 
> routes configuration
>
> D) Expose routes as OSGi services
>      Each route is exposed as OSGi service and uses the 
> producerTemplate to kick off the route when another bundle invokes on 
> the service.
>     Disadvantage: requires additional code to expose and invoke the 
> routes
>
> E) Share Spring context via "<import resource>"
>      One bundle exports spring configuration as resource, another one 
> imports it in Spring configuration. Spring and Camel context are 
> shared.
>     Disadvantage: import resources is not the best OSGi practice, 
> bundles are staying coupled
>
> Do you prefer one of proposed ways or there is a different one?
>
> Regards,
> Andrei.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Another solution is use camel-nmr(camel nmr component is from Apache  
Servicemix) endpoint, you may need take a look at[1] to get more  
details.
[1]http://camel.apache.org/nmr.html

Freeman
On 2011-9-23, at 下午3:46, Andrei Shakirin wrote:

> Hi,
>
> I would like to ask what is the best practice to establish  
> communication between two Camel contexts deployed in a different  
> bundles in OSGi environment.
>
> Actually I see the following ways:
>
> A) VM component.
>    Declare and deploy different contexts and provide communication  
> using "vm:"
>   Disadvantage: VM designed for async communication and creates new  
> threads for consuming messages that not always desired. Addition  
> settings for VM is necessary to get synchronious response.
>
> B) JMS component.
>    The same as (A) but uses JMS component
>   Disadvantage: JMS produces overhead that is not always desired.
>
> C) Share Camel Context as OSGi Service and provide communication  
> using "direct:"
>     Expose Camel Context as OSGi service, get it in other bundles  
> and add the routes. Use "direct:" for communication.
>     Disadvantage: have no idea how use this approach with Spring  
> routes configuration
>
> D) Expose routes as OSGi services
>      Each route is exposed as OSGi service and uses the  
> producerTemplate to kick off the route when another bundle invokes  
> on the service.
>     Disadvantage: requires additional code to expose and invoke the  
> routes
>
> E) Share Spring context via "<import resource>"
>      One bundle exports spring configuration as resource, another  
> one imports it in Spring configuration. Spring and Camel context are  
> shared.
>     Disadvantage: import resources is not the best OSGi practice,  
> bundles are staying coupled
>
> Do you prefer one of proposed ways or there is a different one?
>
> Regards,
> Andrei.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










RE: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Andrei Shakirin <as...@talend.com>.
Hi Christian,

Of course I will use it in case if i call java functionality from Camel.
But in my use case I have namely some Camel routes deployed in different bundles (and implemented by different parties) that have to communicate one with another.

Regards,
Andrei.

-----Original Message-----
From: Christian Schneider [mailto:chris@die-schneider.net] 
Sent: 23 September 2011 12:41
To: users@camel.apache.org
Subject: Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Hi  Andrei,

how about using simple OSGi services? You can create a service reference in your spring context and call it as a bean in a camel route.
This has the advantage that the communication is not tied to camel. So the bundle implementing the service does not have to know about camel.

Christian


  Am 23.09.2011 09:46, schrieb Andrei Shakirin:
> Hi,
>
> I would like to ask what is the best practice to establish communication between two Camel contexts deployed in a different bundles in OSGi environment.
>
> Actually I see the following ways:
>
> A) VM component.
>      Declare and deploy different contexts and provide communication using "vm:"
>     Disadvantage: VM designed for async communication and creates new threads for consuming messages that not always desired. Addition settings for VM is necessary to get synchronious response.
>
> B) JMS component.
>      The same as (A) but uses JMS component
>     Disadvantage: JMS produces overhead that is not always desired.
>
> C) Share Camel Context as OSGi Service and provide communication using "direct:"
>       Expose Camel Context as OSGi service, get it in other bundles and add the routes. Use "direct:" for communication.
>       Disadvantage: have no idea how use this approach with Spring 
> routes configuration
>
> D) Expose routes as OSGi services
>        Each route is exposed as OSGi service and uses the producerTemplate to kick off the route when another bundle invokes on the service.
>       Disadvantage: requires additional code to expose and invoke the 
> routes
>
> E) Share Spring context via "<import resource>"
>        One bundle exports spring configuration as resource, another one imports it in Spring configuration. Spring and Camel context are shared.
>       Disadvantage: import resources is not the best OSGi practice, 
> bundles are staying coupled
>
> Do you prefer one of proposed ways or there is a different one?
>
> Regards,
> Andrei.
>


--
--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Christian Müller <ch...@gmail.com>.
Thanks for the explanation.
I remember, using persistent messaging was the reason to use activemq.

Christian

Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Charles Moulliard <cm...@gmail.com>.
Another advantage of NMR is that you can easily create camel routes
unit test without OSGI container (more info here
camel.apache.org/nmr.html)

On Wed, Oct 12, 2011 at 11:08 AM, Charles Moulliard
<cm...@gmail.com> wrote:
> NMR is an in memory bus that you can use to send sync/async objects
> without the cost of the serialization. Endpoints (producers/consumers)
> are registered in the bus when Camel routes are started and are
> available for all the bundles ! Thread pools can be configured.
>
> NMR is not persistent compare to JMS
>
> On Wed, Oct 12, 2011 at 10:59 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>> Avoiding serialization is the most important one I think.
>>
>> On Wed, Oct 12, 2011 at 10:01, Christian Müller <christian.mueller@gmail.com
>>> wrote:
>>
>>> We use the camel jms/activemq component for this.
>>>
>>> @Charles: Could you please share the advantges of camel nmr over camel
>>> jms/activemq with us!?
>>>
>>> Best,
>>> Christian
>>>
>>> On Wed, Oct 12, 2011 at 8:36 AM, Charles Moulliard <cmoulliard@gmail.com
>>> >wrote:
>>>
>>> > Hi,
>>> >
>>> > On Karaf/Servicemix, the recommended approach to communicate between
>>> > camel routes deployed in separate bundles is to use camel-nmr
>>> > component
>>> >
>>> > Regards,
>>> >
>>> > Charles
>>> >
>>> >
>>> >
>>> > On Fri, Sep 23, 2011 at 12:40 PM, Christian Schneider
>>> > <ch...@die-schneider.net> wrote:
>>> > > Hi  Andrei,
>>> > >
>>> > > how about using simple OSGi services? You can create a service
>>> reference
>>> > in
>>> > > your spring context and call it as a bean in a camel route.
>>> > > This has the advantage that the communication is not tied to camel. So
>>> > the
>>> > > bundle implementing the service does not have to know about camel.
>>> > >
>>> > > Christian
>>> > >
>>> > >
>>> > >  Am 23.09.2011 09:46, schrieb Andrei Shakirin:
>>> > >>
>>> > >> Hi,
>>> > >>
>>> > >> I would like to ask what is the best practice to establish
>>> communication
>>> > >> between two Camel contexts deployed in a different bundles in OSGi
>>> > >> environment.
>>> > >>
>>> > >> Actually I see the following ways:
>>> > >>
>>> > >> A) VM component.
>>> > >>     Declare and deploy different contexts and provide communication
>>> > using
>>> > >> "vm:"
>>> > >>    Disadvantage: VM designed for async communication and creates new
>>> > >> threads for consuming messages that not always desired. Addition
>>> > settings
>>> > >> for VM is necessary to get synchronious response.
>>> > >>
>>> > >> B) JMS component.
>>> > >>     The same as (A) but uses JMS component
>>> > >>    Disadvantage: JMS produces overhead that is not always desired.
>>> > >>
>>> > >> C) Share Camel Context as OSGi Service and provide communication using
>>> > >> "direct:"
>>> > >>      Expose Camel Context as OSGi service, get it in other bundles and
>>> > add
>>> > >> the routes. Use "direct:" for communication.
>>> > >>      Disadvantage: have no idea how use this approach with Spring
>>> routes
>>> > >> configuration
>>> > >>
>>> > >> D) Expose routes as OSGi services
>>> > >>       Each route is exposed as OSGi service and uses the
>>> > producerTemplate
>>> > >> to kick off the route when another bundle invokes on the service.
>>> > >>      Disadvantage: requires additional code to expose and invoke the
>>> > >> routes
>>> > >>
>>> > >> E) Share Spring context via "<import resource>"
>>> > >>       One bundle exports spring configuration as resource, another one
>>> > >> imports it in Spring configuration. Spring and Camel context are
>>> shared.
>>> > >>      Disadvantage: import resources is not the best OSGi practice,
>>> > bundles
>>> > >> are staying coupled
>>> > >>
>>> > >> Do you prefer one of proposed ways or there is a different one?
>>> > >>
>>> > >> Regards,
>>> > >> Andrei.
>>> > >>
>>> > >
>>> > >
>>> > > --
>>> > > --
>>> > > Christian Schneider
>>> > > http://www.liquid-reality.de
>>> > >
>>> > > Open Source Architect
>>> > > Talend Application Integration Division http://www.talend.com
>>> > >
>>> > >
>>> >
>>>
>>
>>
>>
>> --
>> ------------------------
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>>
>

Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Charles Moulliard <cm...@gmail.com>.
NMR is an in memory bus that you can use to send sync/async objects
without the cost of the serialization. Endpoints (producers/consumers)
are registered in the bus when Camel routes are started and are
available for all the bundles ! Thread pools can be configured.

NMR is not persistent compare to JMS

On Wed, Oct 12, 2011 at 10:59 AM, Guillaume Nodet <gn...@gmail.com> wrote:
> Avoiding serialization is the most important one I think.
>
> On Wed, Oct 12, 2011 at 10:01, Christian Müller <christian.mueller@gmail.com
>> wrote:
>
>> We use the camel jms/activemq component for this.
>>
>> @Charles: Could you please share the advantges of camel nmr over camel
>> jms/activemq with us!?
>>
>> Best,
>> Christian
>>
>> On Wed, Oct 12, 2011 at 8:36 AM, Charles Moulliard <cmoulliard@gmail.com
>> >wrote:
>>
>> > Hi,
>> >
>> > On Karaf/Servicemix, the recommended approach to communicate between
>> > camel routes deployed in separate bundles is to use camel-nmr
>> > component
>> >
>> > Regards,
>> >
>> > Charles
>> >
>> >
>> >
>> > On Fri, Sep 23, 2011 at 12:40 PM, Christian Schneider
>> > <ch...@die-schneider.net> wrote:
>> > > Hi  Andrei,
>> > >
>> > > how about using simple OSGi services? You can create a service
>> reference
>> > in
>> > > your spring context and call it as a bean in a camel route.
>> > > This has the advantage that the communication is not tied to camel. So
>> > the
>> > > bundle implementing the service does not have to know about camel.
>> > >
>> > > Christian
>> > >
>> > >
>> > >  Am 23.09.2011 09:46, schrieb Andrei Shakirin:
>> > >>
>> > >> Hi,
>> > >>
>> > >> I would like to ask what is the best practice to establish
>> communication
>> > >> between two Camel contexts deployed in a different bundles in OSGi
>> > >> environment.
>> > >>
>> > >> Actually I see the following ways:
>> > >>
>> > >> A) VM component.
>> > >>     Declare and deploy different contexts and provide communication
>> > using
>> > >> "vm:"
>> > >>    Disadvantage: VM designed for async communication and creates new
>> > >> threads for consuming messages that not always desired. Addition
>> > settings
>> > >> for VM is necessary to get synchronious response.
>> > >>
>> > >> B) JMS component.
>> > >>     The same as (A) but uses JMS component
>> > >>    Disadvantage: JMS produces overhead that is not always desired.
>> > >>
>> > >> C) Share Camel Context as OSGi Service and provide communication using
>> > >> "direct:"
>> > >>      Expose Camel Context as OSGi service, get it in other bundles and
>> > add
>> > >> the routes. Use "direct:" for communication.
>> > >>      Disadvantage: have no idea how use this approach with Spring
>> routes
>> > >> configuration
>> > >>
>> > >> D) Expose routes as OSGi services
>> > >>       Each route is exposed as OSGi service and uses the
>> > producerTemplate
>> > >> to kick off the route when another bundle invokes on the service.
>> > >>      Disadvantage: requires additional code to expose and invoke the
>> > >> routes
>> > >>
>> > >> E) Share Spring context via "<import resource>"
>> > >>       One bundle exports spring configuration as resource, another one
>> > >> imports it in Spring configuration. Spring and Camel context are
>> shared.
>> > >>      Disadvantage: import resources is not the best OSGi practice,
>> > bundles
>> > >> are staying coupled
>> > >>
>> > >> Do you prefer one of proposed ways or there is a different one?
>> > >>
>> > >> Regards,
>> > >> Andrei.
>> > >>
>> > >
>> > >
>> > > --
>> > > --
>> > > Christian Schneider
>> > > http://www.liquid-reality.de
>> > >
>> > > Open Source Architect
>> > > Talend Application Integration Division http://www.talend.com
>> > >
>> > >
>> >
>>
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>

Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Guillaume Nodet <gn...@gmail.com>.
Avoiding serialization is the most important one I think.

On Wed, Oct 12, 2011 at 10:01, Christian Müller <christian.mueller@gmail.com
> wrote:

> We use the camel jms/activemq component for this.
>
> @Charles: Could you please share the advantges of camel nmr over camel
> jms/activemq with us!?
>
> Best,
> Christian
>
> On Wed, Oct 12, 2011 at 8:36 AM, Charles Moulliard <cmoulliard@gmail.com
> >wrote:
>
> > Hi,
> >
> > On Karaf/Servicemix, the recommended approach to communicate between
> > camel routes deployed in separate bundles is to use camel-nmr
> > component
> >
> > Regards,
> >
> > Charles
> >
> >
> >
> > On Fri, Sep 23, 2011 at 12:40 PM, Christian Schneider
> > <ch...@die-schneider.net> wrote:
> > > Hi  Andrei,
> > >
> > > how about using simple OSGi services? You can create a service
> reference
> > in
> > > your spring context and call it as a bean in a camel route.
> > > This has the advantage that the communication is not tied to camel. So
> > the
> > > bundle implementing the service does not have to know about camel.
> > >
> > > Christian
> > >
> > >
> > >  Am 23.09.2011 09:46, schrieb Andrei Shakirin:
> > >>
> > >> Hi,
> > >>
> > >> I would like to ask what is the best practice to establish
> communication
> > >> between two Camel contexts deployed in a different bundles in OSGi
> > >> environment.
> > >>
> > >> Actually I see the following ways:
> > >>
> > >> A) VM component.
> > >>     Declare and deploy different contexts and provide communication
> > using
> > >> "vm:"
> > >>    Disadvantage: VM designed for async communication and creates new
> > >> threads for consuming messages that not always desired. Addition
> > settings
> > >> for VM is necessary to get synchronious response.
> > >>
> > >> B) JMS component.
> > >>     The same as (A) but uses JMS component
> > >>    Disadvantage: JMS produces overhead that is not always desired.
> > >>
> > >> C) Share Camel Context as OSGi Service and provide communication using
> > >> "direct:"
> > >>      Expose Camel Context as OSGi service, get it in other bundles and
> > add
> > >> the routes. Use "direct:" for communication.
> > >>      Disadvantage: have no idea how use this approach with Spring
> routes
> > >> configuration
> > >>
> > >> D) Expose routes as OSGi services
> > >>       Each route is exposed as OSGi service and uses the
> > producerTemplate
> > >> to kick off the route when another bundle invokes on the service.
> > >>      Disadvantage: requires additional code to expose and invoke the
> > >> routes
> > >>
> > >> E) Share Spring context via "<import resource>"
> > >>       One bundle exports spring configuration as resource, another one
> > >> imports it in Spring configuration. Spring and Camel context are
> shared.
> > >>      Disadvantage: import resources is not the best OSGi practice,
> > bundles
> > >> are staying coupled
> > >>
> > >> Do you prefer one of proposed ways or there is a different one?
> > >>
> > >> Regards,
> > >> Andrei.
> > >>
> > >
> > >
> > > --
> > > --
> > > Christian Schneider
> > > http://www.liquid-reality.de
> > >
> > > Open Source Architect
> > > Talend Application Integration Division http://www.talend.com
> > >
> > >
> >
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Christian Müller <ch...@gmail.com>.
We use the camel jms/activemq component for this.

@Charles: Could you please share the advantges of camel nmr over camel
jms/activemq with us!?

Best,
Christian

On Wed, Oct 12, 2011 at 8:36 AM, Charles Moulliard <cm...@gmail.com>wrote:

> Hi,
>
> On Karaf/Servicemix, the recommended approach to communicate between
> camel routes deployed in separate bundles is to use camel-nmr
> component
>
> Regards,
>
> Charles
>
>
>
> On Fri, Sep 23, 2011 at 12:40 PM, Christian Schneider
> <ch...@die-schneider.net> wrote:
> > Hi  Andrei,
> >
> > how about using simple OSGi services? You can create a service reference
> in
> > your spring context and call it as a bean in a camel route.
> > This has the advantage that the communication is not tied to camel. So
> the
> > bundle implementing the service does not have to know about camel.
> >
> > Christian
> >
> >
> >  Am 23.09.2011 09:46, schrieb Andrei Shakirin:
> >>
> >> Hi,
> >>
> >> I would like to ask what is the best practice to establish communication
> >> between two Camel contexts deployed in a different bundles in OSGi
> >> environment.
> >>
> >> Actually I see the following ways:
> >>
> >> A) VM component.
> >>     Declare and deploy different contexts and provide communication
> using
> >> "vm:"
> >>    Disadvantage: VM designed for async communication and creates new
> >> threads for consuming messages that not always desired. Addition
> settings
> >> for VM is necessary to get synchronious response.
> >>
> >> B) JMS component.
> >>     The same as (A) but uses JMS component
> >>    Disadvantage: JMS produces overhead that is not always desired.
> >>
> >> C) Share Camel Context as OSGi Service and provide communication using
> >> "direct:"
> >>      Expose Camel Context as OSGi service, get it in other bundles and
> add
> >> the routes. Use "direct:" for communication.
> >>      Disadvantage: have no idea how use this approach with Spring routes
> >> configuration
> >>
> >> D) Expose routes as OSGi services
> >>       Each route is exposed as OSGi service and uses the
> producerTemplate
> >> to kick off the route when another bundle invokes on the service.
> >>      Disadvantage: requires additional code to expose and invoke the
> >> routes
> >>
> >> E) Share Spring context via "<import resource>"
> >>       One bundle exports spring configuration as resource, another one
> >> imports it in Spring configuration. Spring and Camel context are shared.
> >>      Disadvantage: import resources is not the best OSGi practice,
> bundles
> >> are staying coupled
> >>
> >> Do you prefer one of proposed ways or there is a different one?
> >>
> >> Regards,
> >> Andrei.
> >>
> >
> >
> > --
> > --
> > Christian Schneider
> > http://www.liquid-reality.de
> >
> > Open Source Architect
> > Talend Application Integration Division http://www.talend.com
> >
> >
>

Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Charles Moulliard <cm...@gmail.com>.
Hi,

On Karaf/Servicemix, the recommended approach to communicate between
camel routes deployed in separate bundles is to use camel-nmr
component

Regards,

Charles



On Fri, Sep 23, 2011 at 12:40 PM, Christian Schneider
<ch...@die-schneider.net> wrote:
> Hi  Andrei,
>
> how about using simple OSGi services? You can create a service reference in
> your spring context and call it as a bean in a camel route.
> This has the advantage that the communication is not tied to camel. So the
> bundle implementing the service does not have to know about camel.
>
> Christian
>
>
>  Am 23.09.2011 09:46, schrieb Andrei Shakirin:
>>
>> Hi,
>>
>> I would like to ask what is the best practice to establish communication
>> between two Camel contexts deployed in a different bundles in OSGi
>> environment.
>>
>> Actually I see the following ways:
>>
>> A) VM component.
>>     Declare and deploy different contexts and provide communication using
>> "vm:"
>>    Disadvantage: VM designed for async communication and creates new
>> threads for consuming messages that not always desired. Addition settings
>> for VM is necessary to get synchronious response.
>>
>> B) JMS component.
>>     The same as (A) but uses JMS component
>>    Disadvantage: JMS produces overhead that is not always desired.
>>
>> C) Share Camel Context as OSGi Service and provide communication using
>> "direct:"
>>      Expose Camel Context as OSGi service, get it in other bundles and add
>> the routes. Use "direct:" for communication.
>>      Disadvantage: have no idea how use this approach with Spring routes
>> configuration
>>
>> D) Expose routes as OSGi services
>>       Each route is exposed as OSGi service and uses the producerTemplate
>> to kick off the route when another bundle invokes on the service.
>>      Disadvantage: requires additional code to expose and invoke the
>> routes
>>
>> E) Share Spring context via "<import resource>"
>>       One bundle exports spring configuration as resource, another one
>> imports it in Spring configuration. Spring and Camel context are shared.
>>      Disadvantage: import resources is not the best OSGi practice, bundles
>> are staying coupled
>>
>> Do you prefer one of proposed ways or there is a different one?
>>
>> Regards,
>> Andrei.
>>
>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>
>

Re: Best practices to communicate between Camel Contexts in different OSGi bundles

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi  Andrei,

how about using simple OSGi services? You can create a service reference 
in your spring context and call it as a bean in a camel route.
This has the advantage that the communication is not tied to camel. So 
the bundle implementing the service does not have to know about camel.

Christian


  Am 23.09.2011 09:46, schrieb Andrei Shakirin:
> Hi,
>
> I would like to ask what is the best practice to establish communication between two Camel contexts deployed in a different bundles in OSGi environment.
>
> Actually I see the following ways:
>
> A) VM component.
>      Declare and deploy different contexts and provide communication using "vm:"
>     Disadvantage: VM designed for async communication and creates new threads for consuming messages that not always desired. Addition settings for VM is necessary to get synchronious response.
>
> B) JMS component.
>      The same as (A) but uses JMS component
>     Disadvantage: JMS produces overhead that is not always desired.
>
> C) Share Camel Context as OSGi Service and provide communication using "direct:"
>       Expose Camel Context as OSGi service, get it in other bundles and add the routes. Use "direct:" for communication.
>       Disadvantage: have no idea how use this approach with Spring routes configuration
>
> D) Expose routes as OSGi services
>        Each route is exposed as OSGi service and uses the producerTemplate to kick off the route when another bundle invokes on the service.
>       Disadvantage: requires additional code to expose and invoke the routes
>
> E) Share Spring context via "<import resource>"
>        One bundle exports spring configuration as resource, another one imports it in Spring configuration. Spring and Camel context are shared.
>       Disadvantage: import resources is not the best OSGi practice, bundles are staying coupled
>
> Do you prefer one of proposed ways or there is a different one?
>
> Regards,
> Andrei.
>


-- 
--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com