camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpillet <ben_pil...@yahoo.com>
Subject Problem with sending udp message via netty
Date Wed, 16 May 2012 04:28:55 GMT
I'm building a UDP message forwarder using camel 2.9.2 and activemq 5.5.1. 
On one server I listen to a UDP broadcast and route each datagram to a JMS
queue.
from("mina:udp://0.0.0.0:2222?sync=false")
  .to("jms:queue:udp_queue?disableReplyTo=true");

On another server on another subnet, I connect to the jms queue and route
the exchange to netty like this:
from("jms:queue:udp_queue?disableReplyTo=true")
  .to("netty:udp://192.168.0.101:2223?sync=false");

Everything works just fine if the host 192.168.0.101 is actually listening
for UDP packets on 2223 (I use netcat for that for testing).  The trouble
happens when I stop the udp listener on 192.168.0.101.  Netty starts
receiving ICMP messages from 192.168.0.101 saying that the port is
unreachable and then Netty throws a PortUnreachableException.  I'm fine with
that exception as long as I can catch it and print something user-friendly,
but I can't seem to get a hold of it.

It looks like this exception gets propagated back through the route.  I've
tried wrapping the .to("netty....") part in a doTry()/doCatch() block, but I
can't catch the PortUnreachableException.  I've tried adding onException()
entries for the whole RouteBuilder and within the specific route and I can't
seem to catch it there either.  I've tried
onException(java.net.PortUnreachableException.class) and
onException(Throwable.class) and other funky combinations, but no luck. 
Here is the stacktrace that ends up coming out.  Please help :-]

Regards,
-Ben


[New I/O datagram worker #1'-'4] LoggingErrorHandler            WARN  Cannot
determine current route from Exchange with id:
ID-calvin-34230-1337141905109-0-2, will fallback and use first error
handler.
May 16, 2012 4:18:27 AM org.jboss.netty.channel.DefaultChannelPipeline
WARNING: An exception was thrown by a user handler while handling an
exception event ([id: 0x01f52125, /192.168.0.21:37092 =>
/192.168.0.101:2223] EXCEPTION: java.net.PortUnreachableException)
java.lang.NullPointerException
        at
org.apache.camel.processor.RedeliveryErrorHandler.processAsyncErrorHandler(RedeliveryErrorHandler.java:428)
        at
org.apache.camel.processor.RedeliveryErrorHandler$1.done(RedeliveryErrorHandler.java:351)
        at
org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:80)
        at
org.apache.camel.impl.ProducerCache$1.done(ProducerCache.java:308)
        at
org.apache.camel.processor.SendProcessor$2$1.done(SendProcessor.java:120)
        at
org.apache.camel.component.netty.handlers.ClientChannelHandler.exceptionCaught(ClientChannelHandler.java:86)
        at
org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:238)
        at
org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:432)
        at
org.jboss.netty.channel.socket.nio.NioDatagramWorker.read(NioDatagramWorker.java:406)
        at
org.jboss.netty.channel.socket.nio.NioDatagramWorker.processSelectedKeys(NioDatagramWorker.java:348)
        at
org.jboss.netty.channel.socket.nio.NioDatagramWorker.run(NioDatagramWorker.java:261)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:679)


--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-sending-udp-message-via-netty-tp5710536.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message