Quantcast

Camel Osgi Component

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Camel Osgi Component

Roshan A. Punnoose
Hi,

I am looking for an osgi camel component that acts sort of like a "direct/seda" endpoint between bundles.

For example,

Bundle A:
from("something").to("osgidirect:endpoint")

Bundle B:
from("osgidirect:endpoint")...

Bundle C:
from("osgidirect:endpoint")...

I have been able to develop something like this and it is working in the OSGi container, but I was wondering if there is something already available out there like this.

If not, I can explain how I did this, and get your advice on how to proceed.

So the component works by registering and consuming osgi services. The Consumer gets registered as an OSGi service with property (endpointName="endpoint"), the Producer pulls all services with an OSGi filter of (endpointName="endpoint"). And all this seems to work.

My only issue is how I access the BundleContext. To be able to register and consume services, I need access to the BundleContext of the bundles that are consuming/producing (Bundle A/B/C). The way I have gotten around this right now, is to make sure that I always define the Consumer as a Spring Bean, and implement BundleContextAware, so that Spring DM will inject the BundleContext. However, I don't want to impose this restriction. Looking through the source code, I noticed that the OsgiCamelContext (or OsgiSpringCamelContext) holds the bundleContext as a private variable. Is there anyway we could expose that bundleContext somewhere on the context so that when I create the Consumer/Producer I can pull this from the CamelContext in some way? (Or is it exposed someway already that I haven't seen?)

Thanks so much!

Roshan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Camel Osgi Component

Richard Kettelerij
Hi,

I haven't used Camel with OSGi myself, but the NMR component (http://camel.apache.org/nmr.html) is often recommended for inter-bundle communication. The NMR lives under the ServiceMix project but is also available as a separate distribution (http://servicemix.apache.org/SMX4NMR/download.html).

You might also be interested in this blog post: http://trenaman.blogspot.com/2010/08/easy-useful-nmr-monsieur-nodet-vous.html

Regards,
Richard

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Camel Osgi Component

Roshan A. Punnoose
Thanks! That looks really interesting, and I didn't realize I could send "anything" with NMR.

Is there a way to use NMR without having to set it up in the spring config first? That was the issue I was having with my component as well, to be able to inject the bundle context, I had to have it defined in the spring config. Not sure if anyone has been able to do the same thing with NMR without setting it up in the spring config first. (it looks like it is an OSGi service, maybe it is possible to use it as a bean from the registry? I know we can use osgi services in from the camel bean registry)

Roshan
________________________________________
From: Richard Kettelerij [[hidden email]]
Sent: Tuesday, February 15, 2011 4:15 PM
To: [hidden email]
Subject: Re: Camel Osgi Component

Hi,

I haven't used Camel with OSGi myself, but the NMR component
(http://camel.apache.org/nmr.html) is often recommended for inter-bundle
communication. The NMR lives under the ServiceMix project but is also
available as a separate distribution
(http://servicemix.apache.org/SMX4NMR/download.html).

You might also be interested in this blog post:
http://trenaman.blogspot.com/2010/08/easy-useful-nmr-monsieur-nodet-vous.html

Regards,
Richard


--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Osgi-Component-tp3386193p3386671.html
Sent from the Camel - Users mailing list archive at Nabble.com.

--
Follow this link to mark it as spam:
http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=C4D992836A.AFDF3


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Camel Osgi Component

Roshan A. Punnoose
Also, I realized that camel vm works almost the way I want, except that I would like to broadcast the messages. Instead of a queue, where the first consumer will pick up the message, and the next consumer picks up the next message. I would like every message to go to every consumer. Is this possible?

Roshan
________________________________________
From: Roshan A. Punnoose [[hidden email]]
Sent: Tuesday, February 15, 2011 4:38 PM
To: [hidden email]
Subject: RE: Camel Osgi Component

Thanks! That looks really interesting, and I didn't realize I could send "anything" with NMR.

Is there a way to use NMR without having to set it up in the spring config first? That was the issue I was having with my component as well, to be able to inject the bundle context, I had to have it defined in the spring config. Not sure if anyone has been able to do the same thing with NMR without setting it up in the spring config first. (it looks like it is an OSGi service, maybe it is possible to use it as a bean from the registry? I know we can use osgi services in from the camel bean registry)

Roshan
________________________________________
From: Richard Kettelerij [[hidden email]]
Sent: Tuesday, February 15, 2011 4:15 PM
To: [hidden email]
Subject: Re: Camel Osgi Component

Hi,

I haven't used Camel with OSGi myself, but the NMR component
(http://camel.apache.org/nmr.html) is often recommended for inter-bundle
communication. The NMR lives under the ServiceMix project but is also
available as a separate distribution
(http://servicemix.apache.org/SMX4NMR/download.html).

You might also be interested in this blog post:
http://trenaman.blogspot.com/2010/08/easy-useful-nmr-monsieur-nodet-vous.html

Regards,
Richard


--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Osgi-Component-tp3386193p3386671.html
Sent from the Camel - Users mailing list archive at Nabble.com.

--
Follow this link to mark it as spam:
http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=C4D992836A.AFDF3



--
Follow this link to mark it as spam:
http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=1CBF62836A.A2080


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Camel Osgi Component

Donald Whytock
Since you're having consumers create services, you can have those
services implement Processor, then use OSGI ServiceTracker to collect
services and add them to a Collection to feed to MulticastProcessor.
Use a DelegateProcessor in the route and feed it a new
MulticastProcessor when the ServiceTracker updates the Collection of
consumer services.

On Tue, Feb 15, 2011 at 4:51 PM, Roshan A. Punnoose
<[hidden email]> wrote:

> Also, I realized that camel vm works almost the way I want, except that I would like to broadcast the messages. Instead of a queue, where the first consumer will pick up the message, and the next consumer picks up the next message. I would like every message to go to every consumer. Is this possible?
>
> Roshan
> ________________________________________
> From: Roshan A. Punnoose [[hidden email]]
> Sent: Tuesday, February 15, 2011 4:38 PM
> To: [hidden email]
> Subject: RE: Camel Osgi Component
>
> Thanks! That looks really interesting, and I didn't realize I could send "anything" with NMR.
>
> Is there a way to use NMR without having to set it up in the spring config first? That was the issue I was having with my component as well, to be able to inject the bundle context, I had to have it defined in the spring config. Not sure if anyone has been able to do the same thing with NMR without setting it up in the spring config first. (it looks like it is an OSGi service, maybe it is possible to use it as a bean from the registry? I know we can use osgi services in from the camel bean registry)
>
> Roshan
> ________________________________________
> From: Richard Kettelerij [[hidden email]]
> Sent: Tuesday, February 15, 2011 4:15 PM
> To: [hidden email]
> Subject: Re: Camel Osgi Component
>
> Hi,
>
> I haven't used Camel with OSGi myself, but the NMR component
> (http://camel.apache.org/nmr.html) is often recommended for inter-bundle
> communication. The NMR lives under the ServiceMix project but is also
> available as a separate distribution
> (http://servicemix.apache.org/SMX4NMR/download.html).
>
> You might also be interested in this blog post:
> http://trenaman.blogspot.com/2010/08/easy-useful-nmr-monsieur-nodet-vous.html
>
> Regards,
> Richard
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Osgi-Component-tp3386193p3386671.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
> --
> Follow this link to mark it as spam:
> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=C4D992836A.AFDF3
>
>
>
> --
> Follow this link to mark it as spam:
> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=1CBF62836A.A2080
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Camel Osgi Component

Roshan A. Punnoose
That is interesting, thanks!

To use the ServiceTracker, I need access to the BundleContext. I thought that I could get access to the bundleContext that is already stored in the camelContext, but I can't seem to get access to it.

Roshan
________________________________________
From: Donald Whytock [[hidden email]]
Sent: Wednesday, February 16, 2011 10:11 AM
To: [hidden email]
Subject: Re: Camel Osgi Component

Since you're having consumers create services, you can have those
services implement Processor, then use OSGI ServiceTracker to collect
services and add them to a Collection to feed to MulticastProcessor.
Use a DelegateProcessor in the route and feed it a new
MulticastProcessor when the ServiceTracker updates the Collection of
consumer services.

On Tue, Feb 15, 2011 at 4:51 PM, Roshan A. Punnoose
<[hidden email]> wrote:

> Also, I realized that camel vm works almost the way I want, except that I would like to broadcast the messages. Instead of a queue, where the first consumer will pick up the message, and the next consumer picks up the next message. I would like every message to go to every consumer. Is this possible?
>
> Roshan
> ________________________________________
> From: Roshan A. Punnoose [[hidden email]]
> Sent: Tuesday, February 15, 2011 4:38 PM
> To: [hidden email]
> Subject: RE: Camel Osgi Component
>
> Thanks! That looks really interesting, and I didn't realize I could send "anything" with NMR.
>
> Is there a way to use NMR without having to set it up in the spring config first? That was the issue I was having with my component as well, to be able to inject the bundle context, I had to have it defined in the spring config. Not sure if anyone has been able to do the same thing with NMR without setting it up in the spring config first. (it looks like it is an OSGi service, maybe it is possible to use it as a bean from the registry? I know we can use osgi services in from the camel bean registry)
>
> Roshan
> ________________________________________
> From: Richard Kettelerij [[hidden email]]
> Sent: Tuesday, February 15, 2011 4:15 PM
> To: [hidden email]
> Subject: Re: Camel Osgi Component
>
> Hi,
>
> I haven't used Camel with OSGi myself, but the NMR component
> (http://camel.apache.org/nmr.html) is often recommended for inter-bundle
> communication. The NMR lives under the ServiceMix project but is also
> available as a separate distribution
> (http://servicemix.apache.org/SMX4NMR/download.html).
>
> You might also be interested in this blog post:
> http://trenaman.blogspot.com/2010/08/easy-useful-nmr-monsieur-nodet-vous.html
>
> Regards,
> Richard
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Osgi-Component-tp3386193p3386671.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
> --
> Follow this link to mark it as spam:
> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=C4D992836A.AFDF3
>
>
>
> --
> Follow this link to mark it as spam:
> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=1CBF62836A.A2080
>
>
>

--
Follow this link to mark it as spam:
http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=0CEEB28378.A3E91


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Camel Osgi Component

Donald Whytock
You can get that from the bundle's start() method.  Probably a good
place to set up the ServiceTracker anyway.

Don

On Wed, Feb 16, 2011 at 10:16 AM, Roshan A. Punnoose
<[hidden email]> wrote:

> That is interesting, thanks!
>
> To use the ServiceTracker, I need access to the BundleContext. I thought that I could get access to the bundleContext that is already stored in the camelContext, but I can't seem to get access to it.
>
> Roshan
> ________________________________________
> From: Donald Whytock [[hidden email]]
> Sent: Wednesday, February 16, 2011 10:11 AM
> To: [hidden email]
> Subject: Re: Camel Osgi Component
>
> Since you're having consumers create services, you can have those
> services implement Processor, then use OSGI ServiceTracker to collect
> services and add them to a Collection to feed to MulticastProcessor.
> Use a DelegateProcessor in the route and feed it a new
> MulticastProcessor when the ServiceTracker updates the Collection of
> consumer services.
>
> On Tue, Feb 15, 2011 at 4:51 PM, Roshan A. Punnoose
> <[hidden email]> wrote:
>> Also, I realized that camel vm works almost the way I want, except that I would like to broadcast the messages. Instead of a queue, where the first consumer will pick up the message, and the next consumer picks up the next message. I would like every message to go to every consumer. Is this possible?
>>
>> Roshan
>> ________________________________________
>> From: Roshan A. Punnoose [[hidden email]]
>> Sent: Tuesday, February 15, 2011 4:38 PM
>> To: [hidden email]
>> Subject: RE: Camel Osgi Component
>>
>> Thanks! That looks really interesting, and I didn't realize I could send "anything" with NMR.
>>
>> Is there a way to use NMR without having to set it up in the spring config first? That was the issue I was having with my component as well, to be able to inject the bundle context, I had to have it defined in the spring config. Not sure if anyone has been able to do the same thing with NMR without setting it up in the spring config first. (it looks like it is an OSGi service, maybe it is possible to use it as a bean from the registry? I know we can use osgi services in from the camel bean registry)
>>
>> Roshan
>> ________________________________________
>> From: Richard Kettelerij [[hidden email]]
>> Sent: Tuesday, February 15, 2011 4:15 PM
>> To: [hidden email]
>> Subject: Re: Camel Osgi Component
>>
>> Hi,
>>
>> I haven't used Camel with OSGi myself, but the NMR component
>> (http://camel.apache.org/nmr.html) is often recommended for inter-bundle
>> communication. The NMR lives under the ServiceMix project but is also
>> available as a separate distribution
>> (http://servicemix.apache.org/SMX4NMR/download.html).
>>
>> You might also be interested in this blog post:
>> http://trenaman.blogspot.com/2010/08/easy-useful-nmr-monsieur-nodet-vous.html
>>
>> Regards,
>> Richard
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Camel-Osgi-Component-tp3386193p3386671.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>> --
>> Follow this link to mark it as spam:
>> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=C4D992836A.AFDF3
>>
>>
>>
>> --
>> Follow this link to mark it as spam:
>> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=1CBF62836A.A2080
>>
>>
>>
>
> --
> Follow this link to mark it as spam:
> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=0CEEB28378.A3E91
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Camel Osgi Component

Roshan A. Punnoose
Well here is the thing. I am using Spring DM to build my bundles, I could use the BundleContextAware class to inject the BundleContext into my component and use it in the consumer/producer, but I am trying to find a way that a user could use the component in an osgi framework without having to specify the component in spring dm configuration files. So that in the RouteBuilder, all they have to do is from("osgi...") or something similar.

Looking through the source, the OsgiCamelContext holds the bundleContext as a private variable, but I wasn't sure if there was some way of accessing it. Ideally, when the component is initialized the CamelContext would hold the bundleContext, if it isn't there, I know that camel did not initialize in an osgi container and can deal accordingly.

Does that make sense? Maybe I am making it too difficult.

Roshan
________________________________________
From: Donald Whytock [[hidden email]]
Sent: Wednesday, February 16, 2011 10:23 AM
To: [hidden email]
Subject: Re: Camel Osgi Component

You can get that from the bundle's start() method.  Probably a good
place to set up the ServiceTracker anyway.

Don

On Wed, Feb 16, 2011 at 10:16 AM, Roshan A. Punnoose
<[hidden email]> wrote:

> That is interesting, thanks!
>
> To use the ServiceTracker, I need access to the BundleContext. I thought that I could get access to the bundleContext that is already stored in the camelContext, but I can't seem to get access to it.
>
> Roshan
> ________________________________________
> From: Donald Whytock [[hidden email]]
> Sent: Wednesday, February 16, 2011 10:11 AM
> To: [hidden email]
> Subject: Re: Camel Osgi Component
>
> Since you're having consumers create services, you can have those
> services implement Processor, then use OSGI ServiceTracker to collect
> services and add them to a Collection to feed to MulticastProcessor.
> Use a DelegateProcessor in the route and feed it a new
> MulticastProcessor when the ServiceTracker updates the Collection of
> consumer services.
>
> On Tue, Feb 15, 2011 at 4:51 PM, Roshan A. Punnoose
> <[hidden email]> wrote:
>> Also, I realized that camel vm works almost the way I want, except that I would like to broadcast the messages. Instead of a queue, where the first consumer will pick up the message, and the next consumer picks up the next message. I would like every message to go to every consumer. Is this possible?
>>
>> Roshan
>> ________________________________________
>> From: Roshan A. Punnoose [[hidden email]]
>> Sent: Tuesday, February 15, 2011 4:38 PM
>> To: [hidden email]
>> Subject: RE: Camel Osgi Component
>>
>> Thanks! That looks really interesting, and I didn't realize I could send "anything" with NMR.
>>
>> Is there a way to use NMR without having to set it up in the spring config first? That was the issue I was having with my component as well, to be able to inject the bundle context, I had to have it defined in the spring config. Not sure if anyone has been able to do the same thing with NMR without setting it up in the spring config first. (it looks like it is an OSGi service, maybe it is possible to use it as a bean from the registry? I know we can use osgi services in from the camel bean registry)
>>
>> Roshan
>> ________________________________________
>> From: Richard Kettelerij [[hidden email]]
>> Sent: Tuesday, February 15, 2011 4:15 PM
>> To: [hidden email]
>> Subject: Re: Camel Osgi Component
>>
>> Hi,
>>
>> I haven't used Camel with OSGi myself, but the NMR component
>> (http://camel.apache.org/nmr.html) is often recommended for inter-bundle
>> communication. The NMR lives under the ServiceMix project but is also
>> available as a separate distribution
>> (http://servicemix.apache.org/SMX4NMR/download.html).
>>
>> You might also be interested in this blog post:
>> http://trenaman.blogspot.com/2010/08/easy-useful-nmr-monsieur-nodet-vous.html
>>
>> Regards,
>> Richard
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Camel-Osgi-Component-tp3386193p3386671.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>> --
>> Follow this link to mark it as spam:
>> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=C4D992836A.AFDF3
>>
>>
>>
>> --
>> Follow this link to mark it as spam:
>> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=1CBF62836A.A2080
>>
>>
>>
>
> --
> Follow this link to mark it as spam:
> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=0CEEB28378.A3E91
>
>
>

--
Follow this link to mark it as spam:
http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=E37F528304.A3B20


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Camel Osgi Component

Donald Whytock
Easiest way to get the BundleContext is to override the start()
method, have it call its super, and capture the BundleContext from the
parameter into an instance field.  Later on, if that instance field
isn't null, it means the class was activated as a bundle, and then
you've got the BundleContext.

If it IS null...a static structure to track "osgi" endpoints created?

On Wed, Feb 16, 2011 at 10:29 AM, Roshan A. Punnoose
<[hidden email]> wrote:

> Well here is the thing. I am using Spring DM to build my bundles, I could use the BundleContextAware class to inject the BundleContext into my component and use it in the consumer/producer, but I am trying to find a way that a user could use the component in an osgi framework without having to specify the component in spring dm configuration files. So that in the RouteBuilder, all they have to do is from("osgi...") or something similar.
>
> Looking through the source, the OsgiCamelContext holds the bundleContext as a private variable, but I wasn't sure if there was some way of accessing it. Ideally, when the component is initialized the CamelContext would hold the bundleContext, if it isn't there, I know that camel did not initialize in an osgi container and can deal accordingly.
>
> Does that make sense? Maybe I am making it too difficult.
>
> Roshan
> ________________________________________
> From: Donald Whytock [[hidden email]]
> Sent: Wednesday, February 16, 2011 10:23 AM
> To: [hidden email]
> Subject: Re: Camel Osgi Component
>
> You can get that from the bundle's start() method.  Probably a good
> place to set up the ServiceTracker anyway.
>
> Don
>
> On Wed, Feb 16, 2011 at 10:16 AM, Roshan A. Punnoose
> <[hidden email]> wrote:
>> That is interesting, thanks!
>>
>> To use the ServiceTracker, I need access to the BundleContext. I thought that I could get access to the bundleContext that is already stored in the camelContext, but I can't seem to get access to it.
>>
>> Roshan
>> ________________________________________
>> From: Donald Whytock [[hidden email]]
>> Sent: Wednesday, February 16, 2011 10:11 AM
>> To: [hidden email]
>> Subject: Re: Camel Osgi Component
>>
>> Since you're having consumers create services, you can have those
>> services implement Processor, then use OSGI ServiceTracker to collect
>> services and add them to a Collection to feed to MulticastProcessor.
>> Use a DelegateProcessor in the route and feed it a new
>> MulticastProcessor when the ServiceTracker updates the Collection of
>> consumer services.
>>
>> On Tue, Feb 15, 2011 at 4:51 PM, Roshan A. Punnoose
>> <[hidden email]> wrote:
>>> Also, I realized that camel vm works almost the way I want, except that I would like to broadcast the messages. Instead of a queue, where the first consumer will pick up the message, and the next consumer picks up the next message. I would like every message to go to every consumer. Is this possible?
>>>
>>> Roshan
>>> ________________________________________
>>> From: Roshan A. Punnoose [[hidden email]]
>>> Sent: Tuesday, February 15, 2011 4:38 PM
>>> To: [hidden email]
>>> Subject: RE: Camel Osgi Component
>>>
>>> Thanks! That looks really interesting, and I didn't realize I could send "anything" with NMR.
>>>
>>> Is there a way to use NMR without having to set it up in the spring config first? That was the issue I was having with my component as well, to be able to inject the bundle context, I had to have it defined in the spring config. Not sure if anyone has been able to do the same thing with NMR without setting it up in the spring config first. (it looks like it is an OSGi service, maybe it is possible to use it as a bean from the registry? I know we can use osgi services in from the camel bean registry)
>>>
>>> Roshan
>>> ________________________________________
>>> From: Richard Kettelerij [[hidden email]]
>>> Sent: Tuesday, February 15, 2011 4:15 PM
>>> To: [hidden email]
>>> Subject: Re: Camel Osgi Component
>>>
>>> Hi,
>>>
>>> I haven't used Camel with OSGi myself, but the NMR component
>>> (http://camel.apache.org/nmr.html) is often recommended for inter-bundle
>>> communication. The NMR lives under the ServiceMix project but is also
>>> available as a separate distribution
>>> (http://servicemix.apache.org/SMX4NMR/download.html).
>>>
>>> You might also be interested in this blog post:
>>> http://trenaman.blogspot.com/2010/08/easy-useful-nmr-monsieur-nodet-vous.html
>>>
>>> Regards,
>>> Richard
>>>
>>>
>>> --
>>> View this message in context: http://camel.465427.n5.nabble.com/Camel-Osgi-Component-tp3386193p3386671.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>> --
>>> Follow this link to mark it as spam:
>>> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=C4D992836A.AFDF3
>>>
>>>
>>>
>>> --
>>> Follow this link to mark it as spam:
>>> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=1CBF62836A.A2080
>>>
>>>
>>>
>>
>> --
>> Follow this link to mark it as spam:
>> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=0CEEB28378.A3E91
>>
>>
>>
>
> --
> Follow this link to mark it as spam:
> http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=E37F528304.A3B20
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Camel Osgi Component

Christian Schneider
In reply to this post by Roshan A. Punnoose
Hi Roshan,

I may have a solution may have a solution to your problem. Yesterday I
had a chat with Achim Nierbeck from Karaf and Pax Web. We talked about
integration on OSGi
and if the NMR is needed or not.

So while using the NMR is one option for you Achim also told me he had
succesfully used the seda component to talk between bundles. He simply
published the seda component with interface Component as an
OSGi service. Then he added a service reference to the other bundles. In
spring having a bean with id seda means for camel that there is a
component seda. Without spring you can simply
add the component by hand.

So this could be an easy solution. It is quite elegant as it only needs
to register / reference the component once and then it can be used like
normal.

Christian


Am 15.02.2011 17:16, schrieb Roshan A. Punnoose:

> Hi,
>
> I am looking for an osgi camel component that acts sort of like a "direct/seda" endpoint between bundles.
>
> For example,
>
> Bundle A:
> from("something").to("osgidirect:endpoint")
>
> Bundle B:
> from("osgidirect:endpoint")...
>
> Bundle C:
> from("osgidirect:endpoint")...
>
> I have been able to develop something like this and it is working in the OSGi container, but I was wondering if there is something already available out there like this.
>
> If not, I can explain how I did this, and get your advice on how to proceed.
>
> So the component works by registering and consuming osgi services. The Consumer gets registered as an OSGi service with property (endpointName="endpoint"), the Producer pulls all services with an OSGi filter of (endpointName="endpoint"). And all this seems to work.
>
> My only issue is how I access the BundleContext. To be able to register and consume services, I need access to the BundleContext of the bundles that are consuming/producing (Bundle A/B/C). The way I have gotten around this right now, is to make sure that I always define the Consumer as a Spring Bean, and implement BundleContextAware, so that Spring DM will inject the BundleContext. However, I don't want to impose this restriction. Looking through the source code, I noticed that the OsgiCamelContext (or OsgiSpringCamelContext) holds the bundleContext as a private variable. Is there anyway we could expose that bundleContext somewhere on the context so that when I create the Consumer/Producer I can pull this from the CamelContext in some way? (Or is it exposed someway already that I haven't seen?)
>
> Thanks so much!
>
> Roshan

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Camel Osgi Component

Roshan A. Punnoose
That is a great solution actually, thank you! I'll try it out.

Roshan
________________________________________
From: Christian Schneider [[hidden email]]
Sent: Thursday, February 17, 2011 1:07 AM
To: [hidden email]
Subject: Re: Camel Osgi Component

Hi Roshan,

I may have a solution may have a solution to your problem. Yesterday I
had a chat with Achim Nierbeck from Karaf and Pax Web. We talked about
integration on OSGi
and if the NMR is needed or not.

So while using the NMR is one option for you Achim also told me he had
succesfully used the seda component to talk between bundles. He simply
published the seda component with interface Component as an
OSGi service. Then he added a service reference to the other bundles. In
spring having a bean with id seda means for camel that there is a
component seda. Without spring you can simply
add the component by hand.

So this could be an easy solution. It is quite elegant as it only needs
to register / reference the component once and then it can be used like
normal.

Christian


Am 15.02.2011 17:16, schrieb Roshan A. Punnoose:

> Hi,
>
> I am looking for an osgi camel component that acts sort of like a "direct/seda" endpoint between bundles.
>
> For example,
>
> Bundle A:
> from("something").to("osgidirect:endpoint")
>
> Bundle B:
> from("osgidirect:endpoint")...
>
> Bundle C:
> from("osgidirect:endpoint")...
>
> I have been able to develop something like this and it is working in the OSGi container, but I was wondering if there is something already available out there like this.
>
> If not, I can explain how I did this, and get your advice on how to proceed.
>
> So the component works by registering and consuming osgi services. The Consumer gets registered as an OSGi service with property (endpointName="endpoint"), the Producer pulls all services with an OSGi filter of (endpointName="endpoint"). And all this seems to work.
>
> My only issue is how I access the BundleContext. To be able to register and consume services, I need access to the BundleContext of the bundles that are consuming/producing (Bundle A/B/C). The way I have gotten around this right now, is to make sure that I always define the Consumer as a Spring Bean, and implement BundleContextAware, so that Spring DM will inject the BundleContext. However, I don't want to impose this restriction. Looking through the source code, I noticed that the OsgiCamelContext (or OsgiSpringCamelContext) holds the bundleContext as a private variable. Is there anyway we could expose that bundleContext somewhere on the context so that when I create the Consumer/Producer I can pull this from the CamelContext in some way? (Or is it exposed someway already that I haven't seen?)
>
> Thanks so much!
>
> Roshan

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


--
Follow this link to mark it as spam:
http://mailfilter.proteus-technologies.com/cgi-bin/learn-msg.cgi?id=D3EE828375.A1865


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Camel Osgi Component

m.jimen.blazquez
In reply to this post by Christian Schneider
Hello,

I'm not sure I have understood the process but it seems what I really need. Where can I find an example of this?

regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Camel Osgi Component

Björn Bength
Hello,

read this entire thread before using vm or seda component:

http://camel.465427.n5.nabble.com/using-vm-with-different-camelContexts-and-property-parser-td5022731.html

There seems to be some quirks about error and property handling.
I'm not 100% sure, though, since I didn't read the latest camel source code.

Regards
/Björn

On Fri, Dec 2, 2011 at 10:07 AM, m.jimen.blazquez
<[hidden email]> wrote:

> Hello,
>
> I'm not sure I have understood the process but it seems what I really need.
> Where can I find an example of this?
>
> regards
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Osgi-Component-tp3386193p5041128.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
Loading...