​
Hi Aries community!

I just didn't found a solution to my problem, so I'm asking to the experts
(thank you in advance).

I'm exposing a bean factory from a producer bundle (let say
ManagedJmsListenerFactory).

Then reference this factory in some consumer bundles creating my bean:
[CODE]
<bean id="myQueueListener" factory-ref="myManagedJmsListenerFactory"
factory-method="create">
<argument name="queue" value="MY.QUEUE"/></bean>
​[/CODE]

​ Now, I've got to call a stop() method on all consumer-instanciated
Listener when the consumer bundle stops (or calling stop on predestroy
phase of the instanciated bean).

I may have found a way:
* Making the factory bean prototyped-scope.
* Exposing the factory-bean service with a service registration listener
keeping and index map of factory keys and created Listeners values
* Calling stop on each map values when a factory is unregistered


Is it feasible? Is there a better way (e.g. not duplicating factories)?

Best regards, I love Apache, Aries and all that OSGI stuff.​

-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Reply via email to