让 Smackx PubSub 正常工作
我有以下代码:
PubSubManager manager = new PubSubManager(connection, "pubsub.openfire.local");
LeafNode myNode = (LeafNode) manager.createNode("NewNode", form);
SimplePayload payload = new SimplePayload("session", "pubsub:NewNode:session", "<sessionId>1234</sessionId>");
// putting null for id means you let server generate id
PayloadItem<SimplePayload> item = new PayloadItem<SimplePayload>(null, payload);
// you could use publish() for asynchronous call
myNode.send(item);
并且在尝试发送节点值时不断收到以下错误:
冲突(409) 在>org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:53) 在>org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:61) 在> org.jivesoftware.smackx.pubsub.PubSubManager.sendPubsubPacket(PubSubManager.java:324) >org.jivesoftware.smackx.pubsub.PubSubManager.sendPubsubPacket(PubSubManager.java:318) 在 org.jivesoftware.smackx.pubsub.PubSubManager.createNode(PubSubManager.java:134) 在 PubSubPublisher.main(PubSubPublisher.java:33)
希望有任何关于如何调试或继续推进的想法。谢谢。
I've got the following code:
PubSubManager manager = new PubSubManager(connection, "pubsub.openfire.local");
LeafNode myNode = (LeafNode) manager.createNode("NewNode", form);
SimplePayload payload = new SimplePayload("session", "pubsub:NewNode:session", "<sessionId>1234</sessionId>");
// putting null for id means you let server generate id
PayloadItem<SimplePayload> item = new PayloadItem<SimplePayload>(null, payload);
// you could use publish() for asynchronous call
myNode.send(item);
and I continuously get the following error on trying to send the node value:
conflict(409)
at >org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:53)
at >org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:61)
at >org.jivesoftware.smackx.pubsub.PubSubManager.sendPubsubPacket(PubSubManager.java:324)
at >org.jivesoftware.smackx.pubsub.PubSubManager.sendPubsubPacket(PubSubManager.java:318)
at org.jivesoftware.smackx.pubsub.PubSubManager.createNode(PubSubManager.java:134)
at PubSubPublisher.main(PubSubPublisher.java:33)
Would love any ideas about how to debug, or move forward with this. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尝试创建的节点已存在。调用 getNode 和/或 先删除Node,然后
createNode
。将代码包装在try/catch
块中以处理可能引发的XMPPException
。The node you are trying to create already exists. Call getNode and/or deleteNode first and then
createNode
. Wrap your code in atry/catch
block to handle theXMPPException
that may be thrown.