You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by sathish_alwar <sa...@gmail.com> on 2018/03/13 17:36:25 UTC

Help in Bundle and Blueprint listener

Hi,

We  are using Karaf-4 and we have several bundles (say 100) getting started
as part of our feature. We are using Bundle and Blueprint listener to
monitor the status of each and every bundle. Since all bundles are started
simultaneously we guess the bundle in which we have registered listeners is
sometimes started little late and we loose some bundles states. Please let
us know how to get events for all the bundles without missing any event.

Also please let us know if it is possible to poll all bundles state.
Basically we need to get Bundle object by providing bundle symbolic name and
query for its current state. 



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Help in Bundle and Blueprint listener

Posted by sathish_alwar <sa...@gmail.com>.
Hi,

Thanks both for your prompt responses. We will explore both start level and
prerequisite option to have  listener bundle start before other bundles.

Thanks



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Help in Bundle and Blueprint listener

Posted by Guillaume Nodet <gn...@apache.org>.
2018-03-13 18:36 GMT+01:00 sathish_alwar <sa...@gmail.com>:

> Hi,
>
> We  are using Karaf-4 and we have several bundles (say 100) getting started
> as part of our feature. We are using Bundle and Blueprint listener to
> monitor the status of each and every bundle. Since all bundles are started
> simultaneously we guess the bundle in which we have registered listeners is
> sometimes started little late and we loose some bundles states. Please let
> us know how to get events for all the bundles without missing any event.
>

You need to assign a lower start level to the bundle listening for
blueprint events.


>
> Also please let us know if it is possible to poll all bundles state.
> Basically we need to get Bundle object by providing bundle symbolic name
> and
> query for its current state.
>

It should  be automatic, as the listener should receive events for all
bundles, including "replay" events, i.e. the last event for each bundle.

As an alternative, you can check the BlueprintContainer services that are
registered
for each blueprint bundle.


>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>



-- 
------------------------
Guillaume Nodet

Re: Help in Bundle and Blueprint listener

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

generally speaking, if you have to do such action, it's not good ;)

Anyway, two things:

1. You can retrieve all bundles state using the bundleContext (so the 
framework) anytime
2. You can register a BundleListener (or FrameworkBundleListener) to be 
notify when a bundle state changes. If you want this listener started 
before your bundle, you can wrap it in a feature that is a prerequisite 
for other "user" space features.

Regards
JB

On 13/03/2018 18:36, sathish_alwar wrote:
> Hi,
> 
> We  are using Karaf-4 and we have several bundles (say 100) getting started
> as part of our feature. We are using Bundle and Blueprint listener to
> monitor the status of each and every bundle. Since all bundles are started
> simultaneously we guess the bundle in which we have registered listeners is
> sometimes started little late and we loose some bundles states. Please let
> us know how to get events for all the bundles without missing any event.
> 
> Also please let us know if it is possible to poll all bundles state.
> Basically we need to get Bundle object by providing bundle symbolic name and
> query for its current state.
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>