Repository: camel Updated Branches: refs/heads/master 1f124746c -> d1c06a458
CAMEL-7998 Just call bind if it's UdpConnectionlessSending Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dd913902 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dd913902 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dd913902 Branch: refs/heads/master Commit: dd913902c3e985f186507b64edfee1580a107eeb Parents: 1f12474 Author: Willem Jiang <willem.ji...@gmail.com> Authored: Tue Nov 11 11:41:36 2014 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Tue Nov 11 11:43:36 2014 +0800 ---------------------------------------------------------------------- .../apache/camel/component/netty4/NettyProducer.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/dd913902/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java index caef928..4dd2cac 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java @@ -378,17 +378,19 @@ public class NettyProducer extends DefaultAsyncProducer { // set the pipeline factory, which creates the pipeline for each newly created channels connectionlessClientBootstrap.handler(pipelineFactory); - // bind and store channel so we can close it when stopping - answer = connectionlessClientBootstrap.bind(new InetSocketAddress(0)); - answer.awaitUninterruptibly(); - Channel channel = answer.channel(); - allChannels.add(channel); + // if udp connectionless sending is true we don't do a connect. // we just send on the channel created with bind which means // really fire and forget. You wont get an PortUnreachableException // if no one is listen on the port if (!configuration.isUdpConnectionlessSending()) { answer = connectionlessClientBootstrap.connect(new InetSocketAddress(configuration.getHost(), configuration.getPort())); + } else { + // bind and store channel so we can close it when stopping + answer = connectionlessClientBootstrap.bind(new InetSocketAddress(0)); + answer.awaitUninterruptibly(); + Channel channel = answer.channel(); + allChannels.add(channel); } if (LOG.isDebugEnabled()) {