cschneider / Karaf-Tutorial

http://cschneider.github.io/Karaf-Tutorial/
Apache License 2.0
271 stars 305 forks source link

Using annotation for Bean #32

Closed sekaijin closed 7 years ago

sekaijin commented 7 years ago

Hi I tried to use the annotations and jmx whiteboard to declare mbean but I did not find documentation to guide me.

I saw an example but I did not find how to implement it when there are several instances.

I have somes Beans (blueprint) that derives from an abstract class. This abstract class creates an instance of an MBean class for each instance of Bean

If I put annotation on my class MBean aries creates a single instance independently of my Beans. I'm looking for how to use whiteboard, either by annotation or by code, so that my abstract class automatically declares the created MBean.

To this day I am compelled to do so in every project using this mother class in a dedicated Blueprint file.

If you know where I can find info on how to go about it. With the aries documentation I did not figure out how to do it. Nor even if it is possible.

Thanks for any help.

cschneider commented 7 years ago

You need to export each Bean as an OSGi service. Then it will be published as a JMS bean. If would do this explicitly on each bean and not on the abstract class. If you want to do it on the abstract class then you would need to do the export using the OSGi service API in java code.

sekaijin commented 7 years ago

thank you I'll try it out. A+JYT