You need to shutdown the template if you don't want to use it anymore.
-- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Thursday, July 11, 2013 at 8:10 AM, ignos wrote: > * camel 2.11.0 > * netty 3.6.5.Final > > I make a simple main method to try out a simple message with Netty producer. > The message is well sended, but my application is not exit and tcp > connection is not closed. > > How do I close TCP connections and shutdown my application gracefully? > > sendMessage("camel_tcp", "direct:tcp", "Hello"); > > public void sendMessage(String contextId, String endPoint, String > message) { > SpringCamelContext context = (SpringCamelContext) > applicationContext.getBean(contextId); > ProducerTemplate template = context.createProducerTemplate(); > template.sendBody(endPoint, message); > } > > <camelContext id="camel_tcp" > xmlns="http://camel.apache.org/schema/spring"> > <route> > <from uri="direct:tcp" /> > <to > uri="netty:tcp://localhost:9200?disconnect=true&textline=true" /> > <to uri="log:tcp_log?level=DEBUG"/> > </route> > </camelContext> > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/How-do-I-close-Netty-connections-and-shutdown-my-application-gracefully-tp5735496.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).