AnsweredAssumed Answered

PubSub nonpersistent no payload events are not fireing event listeners on node

Question asked by Sebastian Choina on Nov 24, 2015
Latest reply on Nov 24, 2015 by Sebastian Choina



When using PubSub and trying to publish events on node that has NO PERSISTENT ITEMS, and event itself has NO PAYLOAD, ItemEventListener#handlePublushedItems does not get triggered.

After looking into the code, listener is listening for "item" element, and that is not persistent in this (perfectly valid) use case scenario.


Is it a bug or required behaviour? Listeners get triggered when I publish empty item to PERSISTENT node - but this is different scenario. It is not possible to publish item to node that is configurated to be not persisted according to XEP-0060, and openfire (right thing) returns error.


PubSubManager man = new PubSubManager(getConnectionForClient(client));
LeafNode node = man.createNode("moderator");

ConfigureForm config = new ConfigureForm(DataForm.Type.submit);
node.addItemEventListener(new ItemEventListener() {

   public void handlePublishedItems(ItemPublishEvent items) {

   log.warn("Got some event: {}", items);


log.warn("WILL PUBLISH ITEM");
log.warn("ITEM PUBLISHED");
Thread.sleep(100 * 1000);
(100 * 1000);



and the console output.


D/SMACK: SENT (0): <iq to='' id='f9Qqj-16' type='set'><pubsub xmlns=''><subscribe node='moderator' jid=''/></pubsub></iq>
D/SMACK: RECV (0): <iq type="result" id="f9Qqj-16" from="" to=""><pubsub xmlns=""><subscription node="moderator" jid="" subid="YUuj7T14DoYU477PGWSe9Et74fuhU7B5NGxQOuS6" subscription="subscribed"><subscribe-options/></subscription></pubsub></iq>
W/*torEventsReceivingTest: WILL PUBLISH ITEM
W/*torEventsReceivingTest: ITEM PUBLISHED
D/SMACK: SENT (0): <iq to='' id='f9Qqj-18' type='set'><pubsub xmlns=''><publish node='moderator'/></pubsub></iq>
D/SMACK: RECV (0): <iq type="result" id="f9Qqj-18" from="" to=""/>
D/SMACK: RECV (0): <message from="" to="" id="moderator__test.test.te@mydomain.com__2YiL4"><event xmlns=""><items node="moderator"/></event><headers xmlns=""><header name="SubID">YUuj7T14DoYU477PGWSe9Et74fuhU7B5NGxQOuS6</header></headers></message>

You can clearly see that even is not triggered but event itself is delivered to the client