You can get the CamelContext and get that as BlueprintCamelContext and
OsgiDefaultCamelContext for either of them.

They have the bundle context. But it seems its maybe not exposed as a getter.

We could add those so they have it.

You can use the adapt method on camel context

BlueprintCamelContext blue = context.adapt(BlueprintCamelContext.class);
blue.getBundleContext().getBundle().getBundleId();

We could have a common interface for those osgi stuff so its

OsgiCamelContext osgi = ...

And then its the same for spring-dm and blueprint and scr.

Or add some bundle activator or listener or whatever and grab the
bundle id that way, and then your app can get it from that guy.



On Wed, Mar 30, 2016 at 5:43 PM, Jens <smix...@dzbank.de> wrote:
> Ranx wrote
>> There are a variety of ways to do that but what is it you are after
>> actually?  There may be easier ways to accomplish what you are after.  Are
>> you using Blueprint?  One mechanism is the BlueprintListener.  You can
>> also get the information and inject it during instantiation and I think
>> the FrameworkUtil will also let you get that information (don't quote me
>> on that one though).
>>
>> I find that when I'm trying to get the bundle for some reason there is
>> usually something else I'm trying to accomplish and that there's an
>> easier, different or better way to do it.
>
> I do need the bundle name for a centralized logging service. The processor
> may appear in both routes using Blueprint and routes using Spring. My
> question is, *how* do I get that information (the bundle name)? How do I
> find out which bundle a route or context is defined in (or, alternatively,
> run from)? I don't see how BlueprintListener or FrameworkUtil can help
> there.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-on-OSGi-Get-Bundle-Name-tp5780045p5780062.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to