felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Bartlett <njbartl...@gmail.com>
Subject Re: EventAdmin Bundle Installation
Date Sun, 02 Feb 2014 16:30:35 GMT
On Sun, Feb 2, 2014 at 4:16 PM, masti whoknows <masti_76@yahoo.com> wrote:

> Thanks Marcel for the quick response.
>
> Can someone help clarify: Can I use EventAdmin to pass the event data from
> an non-osgi bundle to an osgi bundle? Or is the eventAdmin only used for
> communicating between osgi bundles?
>

Yes Event Admin can be used in a non-OSGi environment. However it is not a
remote or distributed event broker, it works purely within a single JVM
(although some people have built remoting gateways or bridges that work
alongside Event Admin).

Therefore if you're talking about using it with both non-OSGi and OSGi
artifacts then you probably mean you have an embedded OSGi framework in
your application. Assuming that's the case, then the embedding application
can interact with Event Admin by publishing an EventHandler interface into
OSGi using the system bundle's BundleContext. The limitation is that the
API package for Event Admin will need to be exported by the system bundle
using the FRAMEWORK_SYSTEM_PACKAGES_EXTRA property.


>
> My main application receiving the metrics data/event is non-osgi and it
> needs to forward this event/data to an osgi-bundle. I was using this
> before: bundleContext.registerService(SOME_DATA_TYPE, dataHolderMap, null);
>

Ah yes... I recall your StackOverflow question.


>
> This works fine for low volume of calls but starts to hang the thread gets
> blocked.
>
> Thanks
> Masti
>
>
>
> On Saturday, February 1, 2014 2:44 PM, Marcel Offermans <
> marcel.offermans@luminis.eu> wrote:
>
> On 01 Feb 2014, at 23:20 pm, masti whoknows <masti_76@yahoo.com> wrote:
>
> >     Here is simple Java code that I am using to install the EventAdmin
> bundle
> > //now install the EventAdmin: org.apache.felix.eventadmin 1.3.2
> > Bundle eventAdminBundle =
> >
> framework.getBundleContext().installBundle("org.apache.felix.eventadmin");
> > eventAdminBundle.start();Is this not the right way?
>
> No, as you can see from your own stacktrace, installBundle takes a
> location [1] which is interpreted as a URL. Alternatively, you can use the
> other installBundle method [2] that takes a location (which can then be
> anything) and an inputstream (to your bundle).
>
> That should at least get you to the next point. :)
>
> To learn more about embedding Felix, please read [3] and especially the
> "Host/Felix interaction" part of that document. It contains a lot of
> information related to what you're trying to do.
>
> Greetings, Marcel
>
>
> [1]
> http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#installBundle(java.lang.String)
> [2]
> http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#installBundle(java.lang.String,
> java.io.InputStream)
>
> [3]
> http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-launching-and-embedding.html
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message