On Tue, Sep 18, 2012 at 3:12 PM, Christian Schneider <ch...@die-schneider.net> wrote: > Hi all, > > we had a problem with the camel shutdown at a Talend ESB Camel example after > updating to camel 2.10-SNAPSHOT. > > The example uses a ProducerTemplate with a camel jms producer that is > injected using an annotation: > @EndpointInject > ProducerTemplate producer; > > At the end of the example main the spring context and with it the camel > context is shut down. > Before the update the update the main then exited normally. After the update > it did not exit. > > I found that the ProducerTemplate created a JMSProducer which with a > DefaultMessageListenerContainer for the replies. This was still active and > so the main did not exit. > When I issues a producer.close(); the main exited normally. > > So the question is: Do I need to close a ProducerTemplate myself or should > it be closed when the camel context that created it is shut down? >
Yes its always the clients responsibility to invoke the stop method when you are done with the template. See this FAQ: http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html I have polished the javadoc of the createProducerTemplate methods on CamelContext to make this more clear. > Christian > > --- > Here is the full example: > https://github.com/Talend/tesb-rt-se/tree/master/examples/camel/jaxrs-jms-http/client > and the change that made it work again: > https://github.com/Talend/tesb-rt-se/commit/7a9ae3502ca6f75ff6e38aba9dd94d86578cc028 > > > -- > Christian Schneider > http://www.liquid-reality.de > > Open Source Architect > Talend Application Integration Division http://www.talend.com > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen