I'm using *Camel-2.16* and I'm looking at the GitHub code for the 
NettyProducer.java
<https://github.com/apache/camel/blob/camel-2.16.x/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java>
 
, and I think the below highlighted code is what causes netty to specify
using an ephemeral port for the UDP source port when the camel-netty4
*udpConnectionlessSending* option is set to *true*.  It would be nice if it
wasn't hard-coded and let you specify a UDP source port of your choosing!
I'm hoping someone with more knowledge will chime in.

            // 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)).sync();*
                Channel channel = answer.channel();
                allChannels.add(channel);
            }



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-specify-the-UDP-source-port-with-camel-netty4-tp5775017p5775061.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to