camel-xmpp: fix private chat response issue Responding to a private chat wasn't able because the message was always sent to
String participant = exchange.getIn().getHeader(XmppConstants.TO, String.class); However, the `XmppConstants.TO` in such messages is the camel instance (which received the message) and not the chat's other participant. Thus, responding to a chat message always resultet in a message to itself. This patch fixes that issue and addresses messages always to String participant = endpoint.getParticipant(); Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f7d0c2dc Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f7d0c2dc Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f7d0c2dc Branch: refs/heads/camel-2.17.x Commit: f7d0c2dcb1e6a5192c6293db5e6623da64eb61b2 Parents: 5732ceb Author: Martin Scharm <mar...@binfalse.de> Authored: Sat Apr 9 11:53:12 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat Apr 9 13:33:50 2016 +0200 ---------------------------------------------------------------------- .../org/apache/camel/component/xmpp/XmppPrivateChatProducer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/f7d0c2dc/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java index 322980b..d56e108 100644 --- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java +++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java @@ -65,7 +65,7 @@ public class XmppPrivateChatProducer extends DefaultProducer { throw new RuntimeException("Could not connect to XMPP server.", e); } - String participant = exchange.getIn().getHeader(XmppConstants.TO, String.class); + String participant = endpoint.getParticipant(); String thread = endpoint.getChatId(); if (participant == null) { participant = getParticipant();