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 [[email protected]]
Sent: Wednesday, February 16, 2011 10:23 AM
To: [email protected]
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
<[email protected]> 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 [[email protected]]
> Sent: Wednesday, February 16, 2011 10:11 AM
> To: [email protected]
> 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
> <[email protected]> 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 [[email protected]]
>> Sent: Tuesday, February 15, 2011 4:38 PM
>> To: [email protected]
>> 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 [[email protected]]
>> Sent: Tuesday, February 15, 2011 4:15 PM
>> To: [email protected]
>> 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