Hi,

I have created a custom Camel component that uses a Managed Service for its 
configuration. The idea is to have configuration that can be updated 
dynamically in runtime and that is shared for all bundles that use the 
component. I have a setup along the lines of

Component Bundle
Provides the Managed Service that is configured by the OSGI container
Bundle A
Defines a Camel Route that uses the Component 
Bundle B
Defines another Camel route that also uses the same Component

My current solution is to

Provide a Component Configuration Service in the Component Bundle
Define the Component as a local bean in blueprint.xml for in Bundle A and B
Inject a Service Reference into the local Component blueprint bean in Bundle A 
and B

This works fine but means that each bundle that should use my Custom Camel 
Component requires some boilerplate XML in the blueprint.xml that I would 
rather get rid of.

Does anybody have a better idea on how to used a Managed Service with a custom 
Camel Component?

Best regards,

Chris

PS My initial expectation was that if I provide a ComponentResolver service 
that returns my custom component in the Component Bundle, Camel would be able 
to find my component just by its prefix when creating the routes in Bundle A 
and B. The component would also implement the Managed Service interface and 
thus be configured by the OSGI container.

I do realize that you would get a race condition where it must be ensured that 
the Component Bundle is started before Bundle A and B, or else there would be 
no possibility for Camel to find the Component when creating the routes. The 
solution I used above bypasses this race condition by leveraging Blueprints 
service dampening.

Reply via email to