从 camel xmpp 发送消息时出现问题,jid 格式错误

Problem sending messages from camel xmpp, jid-malformed

我正在尝试使用 camel-xmpp-component 从 A@jabber.de 向用户 B@jabber.de 发送一条(私人)直接消息。但它总是说 "jid-malformed"。 使用此文档:https://camel.apache.org/components/latest/xmpp-component.html

使用 camel 2.24.2 和 java 8 但在 java 11 上出现同样的问题。 我还尝试在 MessageHeaders 中设置 "from" 和 "to"。 我还查看了组件的源代码,它总是将 "from"-JID 构建为带有 "chat@..." 的东西,这与使用 smack 库的所有其他教程不同,如下所示:https://www.baeldung.com/xmpp-smack-chat-client

from("timer:sendMessage?period=5000")
        .setBody(constant("test"))
        .to("xmpp:A@jabber.de:5222/B@jabber.de?user=A&password=xxx");

我希望发送一条消息,但它成功登录,发送时我在日志中收到以下错误:

o.a.c.c.xmpp.XmppLogger        | INBOUND : <message to='A@jabber.de/Camel' from='B@jabber.de@chat:B@jabber.de:A' id='BdCI4-9' type='error'><error type='modify'><jid-malformed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>The destination address is invalid: B@jabber.de@chat:B@jabber.de:A</text></error></message>

感谢任何想法。

您似乎忘记了 "xmpp:" 后的尾部斜杠。

线程名称在创建私人消息时附加到 JID。

https://github.com/apache/camel/blame/master/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppPrivateChatProducer.java#L98

我不是 XMPP 或 Smack 方面的专家,但 Openfire(就我而言)似乎对 JID 中的线程名称不满意。删除线程名称后,我可以发送私人消息。

我已将此 issue 提交给 Camel 错误跟踪器。