Hi

> Yeah would assume depends-on attributes ought to tell blueprint in
> which order to shutdown its beans etc.
> Or somehow you can try to get <camelContext> as being the first
> "bean"
> blueprint should try to shutdown, as then Camel will complete all its
> inflight messages first, and hence the <beans> should be shutdown
> later.
Exactly. Blueprint is responsible for computing the dependency order. On
shutdown, the deconstruction must be done in reverse order.

Therefore I tried to explicitly declare the dependency from CamelContext
to Bean in order to get the CamelContext deconstructed first.

Is Blueprint able to compute the dependencies for a CamelContext? Has it
any clue about the referenced beans?

Does the CamelContext shutdown synchronously to the deconstruction
request of Blueprint? If not, that could be a possible cause, that
dependent Beans get destroyed even if CamelContext is still alive.


> You can also enable cache on the bean endpoint to avoid the lookups
> 
>   <bean uri="ref:myBean?cache=true" />
> 
Yes this helps, but only for beans (component instances). If the
bean endpoint calls a OSGi service reference then call will fail caused
by a ServiceUnavailableException.


> And when you see this error, does that only happen if the aggregator
> has messages that hasn't been fully aggregated, but are forced to be
> completed when stopping? eg this doesn't happen when stopping and the
> aggregator is empty?
Stopping it without any inflight and pending exchanges works. In other
words, there error does not occur, if the aggregator did never aggregate
a message, or if all messages has been aggregated before shutdown.

I'm able to stop the CamelContext manually at any time successfully. Even
if there are pending messages that are forced to be completed when stopping.

The error occurs only if I stop the whole Bundle.



> 
> 
> 
> On Tue, Apr 30, 2013 at 1:25 PM, Tobias Hofer
> <tobias.ho...@basis06.ch> wrote:
> > Hi all,
> >
> > I'm running Camel 2.10.4 in Karaf 2.3.1 and get
> > NoSuchComponentException
> > during the shutdown process.
> >
> > My blueprint configuration file declares a bean which is a Camel
> > Processor
> >
> > <bean id="myBean" class="org.example.MyBean" />
> >
> > The CamelContext contains a route that aggregates incoming messages
> > and
> > which forces a completion on stop.
> >
> > <route>
> >   <from uri="direct:aggregate" />
> >   <aggregate strategyRef="aggregationStrategy"
> >       forceCompletionOnStop="true" ...>
> >     ...
> >     <to uri="direct:onCompletion" />
> >   </aggregate>
> > </route>
> >
> > The second route contains the bean invocation
> >
> > <route>
> >   <from uri="direct:onCompletion" />
> >   ...
> >   <bean ref="myBean" />
> >   ...
> > </route>
> >
> > During shutdown the bean invocation in the second route fails
> >
> > org.apache.camel.RuntimeCamelException:
> > org.osgi.service.blueprint.container.NoSuchComponentException: No
> > component with id
> > 'myBean' could be found
> >         at
> >         
> > org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1316)
> >         at
> >         
> > org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:51)
> >         at
> >         
> > org.apache.camel.component.bean.RegistryBean.lookupBean(RegistryBean.java:136)
> >         at
> >         
> > org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:62)
> >         at
> >         
> > org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:77)
> >         at
> >         
> > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> >         ...
> > Caused by:
> > org.osgi.service.blueprint.container.NoSuchComponentException: No
> > component with id 'myBean' could be found
> >         at
> >         
> > org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:742)
> >         at
> >         
> > org.apache.camel.blueprint.BlueprintContainerRegistry.lookup(BlueprintContainerRegistry.java:41)
> >         at
> >         
> > org.apache.camel.impl.CompositeRegistry.lookup(CompositeRegistry.java:68)
> >         at
> >         
> > org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:49)
> >
> > I tried to add a 'depends-on' property on the CamelContext
> > declaration but
> > this seems not to help.
> >
> > It looks like that the Blueprint Container is no longer available.
> >
> > Any suggestions?
> >
> > Regards,
> > Tobias Hofer
> >
> >
> >
> >
> >
> 
> 
> 
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cib...@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> 

Reply via email to