Quantcast

ActiveMq + karaf + shutdown

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

ActiveMq + karaf + shutdown

xav
Hi all,

I have a question about ActiveMq embedded in Karaf.
I would like to shutdown the feature activemq-broker-noweb at the end.
Why, because I have a feature (bundles connected with the broker) which stop (on a karaf shutdown) after  the activemq and I would like the reverse, i.e. shutdown my feature, and after shutdown the activemq feature.
Do we have only the start-level at our disposition?
 
Thx a lot for a help

Regards

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

Re: ActiveMq + karaf + shutdown

jbonofre
Hi Xav,

There's no easy way. I think that if you define a chain a feature with broker
providing a cap and your feature having a req on this cap, then the resolver
should be able to uninstall.

Generally speaking, it's not a good approach, the bundles should be atomic
meaning that if the broker is not there, they stop to produce or consume, and
that's it.

Regards
JB

On 03/29/2017 10:07 AM, xav wrote:

> Hi all,
>
> I have a question about ActiveMq embedded in Karaf.
> I would like to shutdown the feature activemq-broker-noweb at the end.
> Why, because I have a feature (bundles connected with the broker) which stop
> (on a karaf shutdown) after  the activemq and I would like the reverse, i.e.
> shutdown my feature, and after shutdown the activemq feature.
> Do we have only the start-level at our disposition?
>
> Thx a lot for a help
>
> Regards
>
> Xav
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/ActiveMq-karaf-shutdown-tp4049950.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
xav
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ActiveMq + karaf + shutdown

xav
Hi JB,

Thx a lot for this quick answer.
Ok I agree with you, but I wanted to be sure of this approach.
I saw this: http://activemq.apache.org/how-can-i-monitor-the-connection-with-the-broker.html
to be notify on the activemq status (connection), so perhaps in my bundle, I could use this approach to know, if the broker is there or not?

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

Re: ActiveMq + karaf + shutdown

cschneider
In reply to this post by xav
In OSGi you should solve such things using service dependencies.

I just checked which services activemq provides (see below).
So you could have a service dependency on one of these. If you use
declarative services for your own components and add a reference to one
of these services then your component should
be stopped before activemq goes down.

As a dependency to the specific blueprint context service is a bit of a
tight coupling a good solution might be to create a DS component named
like ActiveMQPresent which holds the reference to the blueprint context
of activemq and just reference this service in your other components.

Be aware though that this does not work with blueprint as blueprint does
not shut down the context when a referenced service goes down.

Christian

----
karaf@root()> bundle:services -p org.apache.activemq.activemq-osgi 10:25:17

activemq-osgi (62) provides:
----------------------------
objectClass = [org.osgi.service.cm.ManagedServiceFactory]
osgi.service.blueprint.compname = activeMQServiceFactory
service.bundleid = 62
service.id = 149
service.pid = org.apache.activemq.server
service.scope = bundle
----
objectClass = [org.osgi.service.blueprint.container.BlueprintContainer]
osgi.blueprint.container.symbolicname = org.apache.activemq.activemq-osgi
osgi.blueprint.container.version = 5.14.5.SNAPSHOT
service.bundleid = 62
service.id = 150
service.scope = singleton


On 29.03.2017 10:07, xav wrote:

> Hi all,
>
> I have a question about ActiveMq embedded in Karaf.
> I would like to shutdown the feature activemq-broker-noweb at the end.
> Why, because I have a feature (bundles connected with the broker) which stop
> (on a karaf shutdown) after  the activemq and I would like the reverse, i.e.
> shutdown my feature, and after shutdown the activemq feature.
> Do we have only the start-level at our disposition?
>  
> Thx a lot for a help
>
> Regards
>
> Xav
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/ActiveMq-karaf-shutdown-tp4049950.html
> Sent from the Karaf - User mailing list archive at Nabble.com.


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

Open Source Architect
http://www.talend.com

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

Re: ActiveMq + karaf + shutdown

xav
Hi Christian,

Thx for your comment, I will try asap, and send my feedback

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

Re: ActiveMq + karaf + shutdown

xav
Hi all,

Here my solution:
I use ipojo, so i used the @Unbind annotation

@Unbind(specification = org.osgi.service.cm.ManagedServiceFactory.class, aggregate = true)
public final void unbindBrokerService(final org.osgi.service.cm.ManagedServiceFactory managedServiceFactory) {
        logger.info(managedServiceFactory.getName() + " disapears.");
        isBrokerActive = false;
    }

It's work, so thx to Christian an JB for theirs post.

Regards
Loading...