You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2015/04/22 13:18:06 UTC

[3/3] camel git commit: CAMEL-8674 Set remote UDP address in headers of camel-netty4 message

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/9c84398e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9c84398e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9c84398e

Branch: refs/heads/camel-2.14.x
Commit: 9c84398e2619dfd02f235b8bead4d81ab876a347
Parents: f98158a
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Apr 22 16:18:31 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Apr 22 19:17:28 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/9c84398e/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 714957b..dd114e2 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
@@ -73,6 +73,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/9c84398e/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));
                     }
                 });
             }