Hi Ashwin, thank you for your response. Can you please post the detailed error message.
Here is the BindException I receive for the following route: <camel:camelContext id="snapCamelContext" xmlns=" http://camel.apache.org/schema/spring"> <route> <from uri="netty:tcp://192.168.0.111:50001?decoders=#decoders&sync=false" /> <bean ref="TransformMessage" method="inboundDecoder" /> <to uri="eventadmin:messages/aacus/inbound" /> </route> <route> <from uri="eventadmin:messages/aacus/outbound" /> <bean ref="TransformMessage" method="outboundEncoder" /> <to uri="netty:tcp:// 192.168.0.111:50001?allowDefaultCodec=false&sync=false" /> </route> </camel:camelContext> --------------------------------------------- Exception in thread "SpringOsgiExtenderThread-10" org.apache.camel.RuntimeCamelException: org.jboss.netty.channel.ChannelException: Failed to bind to: / 192.168.0.111:50001 at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139) at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103) at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:237) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911) at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358) at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136) at java.lang.Thread.run(Thread.java:662) Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: / 192.168.0.111:50001 at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:303) at org.apache.camel.component.netty.NettyConsumer.initializeTCPServerSocketCommunicationLayer(NettyConsumer.java:168) at org.apache.camel.component.netty.NettyConsumer.doStart(NettyConsumer.java:69) at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65) at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1593) at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1859) at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1812) at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1738) at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1528) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1420) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1321) at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164) at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65) at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1299) at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203) at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101) ... 10 more Caused by: java.net.BindException: Cannot assign requested address: bind at sun.nio.ch.Net.bind(Native Method) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.bind(NioServerSocketPipelineSink.java:148) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleServerSocket(NioServerSocketPipelineSink.java:100) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:74) at org.jboss.netty.channel.Channels.bind(Channels.java:468) at org.jboss.netty.channel.AbstractChannel.bind(AbstractChannel.java:200) at org.jboss.netty.bootstrap.ServerBootstrap$Binder.channelOpen(ServerBootstrap.java:348) at org.jboss.netty.channel.Channels.fireChannelOpen(Channels.java:176) at org.jboss.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:85) at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:142) at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:90) at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:282) ... 28 more ------------------------------------ Also, please be aware that the notion of callbacks on a different port are > not possible using a netty consumer. This is due to the way the TCP > connection object is used and works. You can however use keepalives and > communicate back and forth on the 2 TCP ports that are bound to the TCP > connection. This sounds like what I am already doing using standard Java Socket: Socket socket = new Socket(addr, port); BufferedInputStream bis = new BufferedInputStream(socket.getInputStream()); int r = bis.read(); BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream()); etc... What I want is to do the same thing with Camel-Netty. Are you telling me that this is possible? The solution I am working on right now is a custom component as the producer and consumer endpoints and bypassing Netty altogether. I expect this to work, but if I can do it with Netty, it would be better. You could however sent a port number in the message and have the server set > up a route that dispatches to a port using a ProducerTemplate. The server is implemented in C++, cannot be modified, and is not setup for dispatch port configuration. Thanks, Namaste -- View this message in context: http://camel.465427.n5.nabble.com/two-way-communication-with-TCP-server-using-Netty-tp4702360p4704615.html Sent from the Camel - Users mailing list archive at Nabble.com.
