Repository: camel Updated Branches: refs/heads/master cc613d164 -> 234640052
CAMEL-8674 Set remote UDP address in headers of camel-netty4 message Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/85ccae49 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/85ccae49 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/85ccae49 Branch: refs/heads/master Commit: 85ccae497e3771fa6e3e086f2796a1e6e2c05584 Parents: cc613d1 Author: Willem Jiang <willem.ji...@gmail.com> Authored: Wed Apr 22 16:18:31 2015 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Wed Apr 22 19:15:22 2015 +0800 ---------------------------------------------------------------------- .../java/org/apache/camel/component/netty4/NettyPayloadHelper.java | 2 ++ .../component/netty4/NettyUdpWithInOutUsingPlainSocketTest.java | 2 ++ 2 files changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/85ccae49/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java index 3e2a27c..83365ce 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java @@ -78,6 +78,8 @@ public final class NettyPayloadHelper { } // setup the sender address here for sending the response message back exchange.setProperty(NettyConstants.NETTY_REMOTE_ADDRESS, dp.sender()); + // setup the remote address to the message header at the same time + exchange.getIn().setHeader(NettyConstants.NETTY_REMOTE_ADDRESS, dp.sender()); } else { // normal transfer using the body only exchange.getIn().setBody(payload); http://git-wip-us.apache.org/repos/asf/camel/blob/85ccae49/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpWithInOutUsingPlainSocketTest.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpWithInOutUsingPlainSocketTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpWithInOutUsingPlainSocketTest.java index 7fafbd7..3d507af 100644 --- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpWithInOutUsingPlainSocketTest.java +++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpWithInOutUsingPlainSocketTest.java @@ -71,6 +71,8 @@ public class NettyUdpWithInOutUsingPlainSocketTest extends BaseNettyTest { String s = exchange.getIn().getBody(String.class); LOG.debug("Server got: " + s); exchange.getOut().setBody("Hello " + s); + // just make the remote address is there + assertNotNull("The remote address header should not be Null", exchange.getIn().getHeader(NettyConstants.NETTY_REMOTE_ADDRESS)); } }); }