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

Marc-André Laverdière marcandre.laverdiere at gmail.com
Tue May 24 20:27:13 EDT 2011


I do not know camel at all, but it looks like the Netty side is missing the
bootstrap, pipeline factory, etc.

Just my 2 paisa :)
On 24-May-2011 7:43 PM, "sachin2713 at gmail.com" <sachin2713 at gmail.com> wrote:
> 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.
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20110525/d475e419/attachment.html 


More information about the netty-users mailing list