Search code examples
javaxmppopenfiresmack

pubsub publish to node success, retrieve from node fail


Below showed i suggest published to node call "ghost2"

iq id="kB8dk-0" to="computer/2c10ee6b" type="result"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>admin@computer/Smack</jid></bind></iq>
<iq id="kB8dk-1" to="admin@computer/Smack" type="result"></iq>
<iq id="kB8dk-2" to="admin@computer/Smack" type="result"><query xmlns="jabber:iq:roster"><item jid="test" name="test" subscription="none"></item><item jid="test@computer" subscription="from"></item></query></iq>
<message id="admin@computer__admin@computer__ChWrY" to="admin@computer" from="admin@computer"><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='null'><item id='ghost2'/></items></event></message>
<iq id="kB8dk-4" to="admin@computer/Smack" from="computer" type="result"></iq>
<iq id="kB8dk-5" to="admin@computer/Smack" from="computer" type="result"></iq>
<message id="ghost2__admin@computer__DGaLS" to="admin@computer" from="admin@computer"><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='ghost2'><item id='testid2'><book xmlns="pubsub:test:book"><title>book x</title></book></item></items></event></message>

but when i try to subsript and retrieve from the same node , i get error 404

<iq id="zpWDI-0" to="computer/b7fe68a8" type="result"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>test@computer/Smack</jid></bind></iq>
<iq id="zpWDI-1" to="test@computer/Smack" type="result"></iq>
<iq id="zpWDI-2" to="test@computer/Smack" type="result"><query xmlns="jabber:iq:roster"><item jid="admin@computer" name="test" subscription="to"><group>Friends</group></item><item jid="test" name="test" subscription="none"></item></query></iq>
<presence id="kB8dk-3" to="test@computer/Smack" from="admin@computer/Smack"></presence>
<message id="admin@computer__test@computer__tAVfB" to="test@computer/Smack" from="admin@computer"><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='TestNode2323'><item id='2Ke42PVQ77iSCP0'><book xmlns="pubsub:test:book"><title>book x</title></book></item></items></event><x xmlns="jabber:x:delay" stamp="20091013T14:16:32"></x><addresses xmlns="http://jabber.org/protocol/address"><address type="replyto" jid="admin@computer/god"/></addresses></message>
<iq id="zpWDI-4" to="test@computer/Smack" from="computer" type="error"><query xmlns="http://jabber.org/protocol/disco#info" node="ghost2"></query><error code="404" type="CANCEL"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

Solution

  • You've received the published item:

    <book xmlns="pubsub:test:book"><title>book x</title></book>
    

    You've received the 404 error from "computer" (your xmpp server) for this query:

    <query xmlns="http://jabber.org/protocol/disco#info" node="ghost2"></query>
    

    Which hast to do with service discovery. Is it possible that you've removed some messages from the complete conversation?

    Edit:

    Could you try to replace:

    PubSubManager manager = new PubSubManager(connection, "computer");
    

    with this

    String pubSubAddress = "pubsub." + connection.getServiceName();
    PubSubManager manager = new PubSubManager(connection, pubSubAddress);