1
votes

The subscriber will only receive content from the moment he is subscripting to a node and all old content published by publisher will not be received by subscriber. Is this correct? May i know, what do i need to do in order for subscriber to receive all previous old content ?

1

1 Answers

4
votes

You can configure your nodes to be persistent or transient. According to the specifictaion (XEP-0060):

Whether the node is persistent or transient is determined by the "pubsub#persist_items" configuration field.

However, your pubsub service (or server) might be configured to ignore persistence of events. (If you're using Openfire, I think there is a configurable limit for the maximum total size of stored items)

As I know you are using smackx-pubsub, here's some code:

// create new node
pubSubManager.createNode(nodeId, newConfigureForm(persistent, includePayload, accessModel)

// change existing node
node.sendConfigurationForm(newConfigureForm(persistent, includePayload, accessModel));

private ConfigureForm newConfigureForm(final boolean persistent, final boolean includePayload, final AccessModel accessModel) {
  final ConfigureForm form = new ConfigureForm(FormType.submit);
  form.setPersistentItems(persistent);
  form.setDeliverPayloads(includePayload);
  form.setAccessModel(accessModel);
  return form;
}

PS: Can you tell me why I get the feeling that we're doing a kind of pair programming here? ;)