Netty Consumer is not able to pick up messagefrom any port sent through simple java socket clinet

sachin2713 at gmail.com sachin2713 at gmail.com
Tue May 24 10:12:25 EDT 2011


Hi, 
I am very new to camel and netty, please forgive my stupid mistakes.

I am using Camel 2.6 along with netty 3.2.3 for tcp communication.
I am starting an endpoint at server startup which should execute any other
business processing after receiving message.

1) As i dont want to bound clients with netty producer, i have to test
sending message without netty producer , hence i am using simple java socket
client to send message to any port.But my processor is not able to pick up
the message. SHouldnt it be independent of client?

2) Though when i try with netty producer , it works fine, but for only once
in one connection. second time it's not able to pick up message from netty
producer also, i have to restart my server i.e camel again.

Below is my code:


EndPoint in camel-context:
<endpoint id="ByteStreamTransport"
			uri="netty:tcp://localhost:6123connectTimeout=5000&amp;sync=false" />




Java Client:( not complete)

socket = new Socket();
socket.connect(new InetSocketAddress("localhost", 9990));
OutputStream os = socket.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(os);
		          // oos.writeObject(emp);
		        
socket.getOutputStream().write(bytes);
socket.getOutputStream().flush();
socket.shutdownOutput(
)




Netty Consumer:(I can see in logs that netty consumer is bound to this port)

try {
NettyConsumer consumer = (NettyConsumer)
tcpProfile.getEndPoint().createConsumer(new TCPProcessor(this ,tcpProfile));
consumer.start();						



Netty Producer:
try {
		
		  context = new DefaultCamelContext(); 
          
	        context.start(); 

		Endpoint endpoint =
context.getEndpoint("netty:tcp://localhost:6123?sync=false");
		Exchange exchange = endpoint.createExchange(ExchangePattern.InOnly);
		exchange.getIn().setBody("sachin1");
		producer = (NettyProducer)endpoint.createProducer();
		producer.start();			
		producer.process(exchange);
		
				
	}
	catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}					}


--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Netty-Consumer-is-not-able-to-pick-up-messagefrom-any-port-sent-through-simple-java-socket-clinet-tp6398719p6398719.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list