1

订阅者只会从订阅节点的那一刻起收到内容,并且订阅者不会收到发布者发布的所有旧内容。它是否正确?我可以知道,为了让订阅者接收所有以前的旧内容,我需要做什么?

4

1 回答 1

4

您可以将节点配置为持久或瞬态。根据规范(XEP-0060)

节点是持久的还是临时的由“pubsub#persist_items”配置字段决定。

但是,您的 pubsub 服务(或服务器)可能被配置为忽略事件的持久性。(如果您使用的是 Openfire,我认为存储项目的最大总大小有一个可配置的限制)

据我所知,您正在使用smackx-pubsub,这里有一些代码:

// 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:你能告诉我为什么我觉得我们在这里做一种结对编程吗?;)

于 2009-10-16T13:49:52.877 回答