Pubsub questions

Question 1:

Why does the code below create a pubsub node called ‘’/testing’’ rather than ‘‘testing’’?

Question 2:

Assuming there is a sensible answer to Q1, why do other commands not do the same?

e.g. the code below returns item-not-found unless I change the node to ‘’/testing’’

Question 3:

Same as question 2, but for delete and purge commands?

Question 4:

Why does the code below return bad-request : subid-required ?

Well, actually I’'ve had a look at the source code for PubsubEngine.getPublishedItems

and I can see that it needs a subscription id when node.isMultipleSubscriptionsEnabled() returns true.

But I can’'t see a way to override this in pubsub node configuration as it looks to me as though the return

value of node.isMultipleSubscriptionsEnabled() is hard coded.

So, it seems to me I can’'t retrieve items of a node without doing the extra work of extracting the subscription

id’‘s by using the subscriptions command first. Seems like an unnecessary headache, when I’‘m not creating multiple subscriptions and I don’‘t think I need to support it. Is there a way switch multiple subscription off, or perhaps to make it so that it doesn’'t complain if a node only has one subscription?

Thanks.

Chris Denham

Hey Chris,

Question 1:

Why does the code below create a pubsub node called ‘’/testing’’ rather than ‘‘testing’’?

<pubsub xmlns=’‘http://jabber.org/protocol/pubsub’’>

<create node=’‘testing’’/>

The reason for that is that Wildfire supports hierarchical nodes and / refers to the root node. So when you add a new node its nodeID will start with / to indicate that it is a child node of the root node.

Question 2:

Assuming there is a sensible answer to Q1, why do other commands not do the same?

e.g. the code below returns item-not-found unless I change the node to ‘’/testing’’

<pubsub xmlns=’‘http://jabber.org/protocol/pubsub’’>

<items node=’‘testing’’/>

When you create a new node the pubsub service will return the actual nodeID that was created for the new node. Subsequent operations must use the returned nodeID to refer to the created node. Since testing was not found the service will return item-not-found.

Question 3:

Same as question 2, but for delete and purge commands?

Same answer for question 2.

Question 4:

Why does the code below return bad-request : subid-required ?

<pubsub xmlns=’‘http://jabber.org/protocol/pubsub’’>

<items node=’’/testing’’/>

Well, actually I’'ve had a look at the source code for PubsubEngine.getPublishedItems

and I can see that it needs a subscription id when node.isMultipleSubscriptionsEnabled() returns true.

But I can’'t see a way to override this in pubsub node configuration as it looks to me as though the return

value of node.isMultipleSubscriptionsEnabled() is hard coded.

So, it seems to me I can’'t retrieve items of a node without doing the extra work of extracting the subscription

id’‘s by using the subscriptions command first. Seems like an unnecessary headache, when I’‘m not creating multiple subscriptions and I don’‘t think I need to support it. Is there a way switch multiple subscription off, or perhaps to make it so that it doesn’'t complain if a node only has one subscription?

Good catch. It seems that current implementation is not following the initial idea as expressed in the javadoc of the Node#isMultipleSubscriptionsEnabled() method. We need to change that method to ask the PubSubService if that feature is enabled. PubSubService can use a system property to answer that.

Regards,

– Gato

Hey Chris,

I just created JM-913 and filed a fix for that. You will find it in the next nightly build version.

Regards,

– Gato

Wow, Gato you’'re a star.

I’'ll try out the new version ASAP.

Cheers.

Chris.