As you may know, in OSGi world we cannot assure we can get the service we want 
at the start time as the service bundle could not be started at that time.
Camel OSGi implementation always waits for loading the component, so you need 
change the code to install the component first instead of try to load it first.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 22, 2014 at 8:40:53 PM, Matthieu Vincent ([email protected]) wrote:
> Hi
>  
> I'm trying to add a component in my camel context using method
> addComponent on CamelContext.
> Everything seems to work correctly, but when my servicemix starts, the
> bundle stays in state GracePeriod and in log file I can read :
>  
> 2014-04-22 14:24:45,913 | INFO | rint Extender: 2 | BlueprintContainerImpl
> | 10 - org.apache.aries.blueprint - 0.3.2 | *Bundle esb-sync is
> waiting for dependencies [(&(component=central*
> *)(objectClass=org.apache.camel.spi.ComponentResolver))]*
>  
> Here is my method to add component* :*
>  
> private void addBrokerToCamelContext(String componentId, String
> brokerUrl) {
> if (getContext().getComponent(componentId) == null) {
> LOGGER.info("Registering component {}", componentId);
> ActiveMQComponent component =
> ActiveMQComponent.activeMQComponent(brokerUrl);
> component.setAcknowledgementMode(Session.AUTO_ACKNOWLEDGE);
> component.setCamelContext(getContext());
> try {
> component.start();
> } catch (Exception exc) {
> LOGGER.error("Problem starting component {}", componentId,
> exc);
> }
> getContext().addComponent(componentId, component);
> } else {
> LOGGER.info("Component {} already created", componentId);
> }
> }
>  
> Thanks for help
> Matthieu
>  

Reply via email to