Re: How do I close Netty connections and shutdown my application gracefully?
I'm sorry, I don't mention it rightly. NettyProducer closes all the open channels when it is stopped. context.stop will shutdown the routes, consumers and producers. If you don't want to shutdown the CamelContext to close the channel, you can set the option disconnect to be true. -- 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 1:57 PM, ignos wrote: Thanks. I edit the source. SpringCamelContext context = (SpringCamelContext) applicationContext.getBean(contextId); context.start(); ProducerTemplate template = context.createProducerTemplate(); template.sendBody(endPoint, message); context.stop(); context.stop() works the way I want it to. There is something I have been curious about. What's the difference between context.stop() and template.stop()? -- View this message in context: http://camel.465427.n5.nabble.com/How-do-I-close-Netty-connections-and-shutdown-my-application-gracefully-tp5735496p5735504.html Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
Re: How do I close Netty connections and shutdown my application gracefully?
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=trueamp;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).
Re: How do I close Netty connections and shutdown my application gracefully?
Thanks. I edit the source. SpringCamelContext context = (SpringCamelContext) applicationContext.getBean(contextId); context.start(); ProducerTemplate template = context.createProducerTemplate(); template.sendBody(endPoint, message); context.stop(); context.stop() works the way I want it to. There is something I have been curious about. What's the difference between context.stop() and template.stop()? -- View this message in context: http://camel.465427.n5.nabble.com/How-do-I-close-Netty-connections-and-shutdown-my-application-gracefully-tp5735496p5735504.html Sent from the Camel - Users mailing list archive at Nabble.com.