Hi

IMHO instead of the "stop" workaround better let the IoC container do the
job for you. That's instead of declaring it like:

@EndpointInject
ProducerTemplate producer;

Simply do:

@Autowired
ProducerTemplate producer;

And declare the ProducerTemplate the way from the Wiki (see the XML-snippet
of what Claus already sent):

 <camelContext id="camelContext"
xmlns="http://camel.apache.org/schema/spring"; trace="true">
   <template id="..."/>

And then Spring will take care of the rest (no need for an explicit stop
call anymore). The same also applies if you would make use of Blueprint
instead of Spring.

Under the cover the following FactoryBeans do the Job (see the destroy
method implementation which they both share):

https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java
https://svn.apache.org/repos/asf/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProducerTemplateFactoryBean.java

Babak




--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-ProducerTemplate-on-context-shutdown-tp5719525p5719533.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to