Hello,
I’m wondering why I’m receiving the same notification every time I login to the server from the node I subscriped ??
I thought that, I will receive the notification just one time unless there is a new published Item on the node.
Here is my code of node creation :
con.connect();
con.login();
PubSubManager pm = new PubSubManager(con);
ConfigureForm form = new ConfigureForm(Type.submit);
form.setAccessModel(AccessModel.open);
form.setDeliverPayloads(true);
form.setNotifyRetract(false);
form.setPersistentItems(false);
form.setPublishModel(PublishModel.subscribers);
LeafNode node = (LeafNode) pm.createNode("sameh" ,form);
]publishing Item to the node “sameh” :
Publishing payload item :
LeafNode node = pm.getNode("sameh"); SimplePayload spa = new SimplePayload("samehId", "pubsub:categories:sameh"
, "<samehId xmlns='pubsub:categories:sameh'><hello>sameh2200099990000</hello></nnaassCategoryId>"); PayloadItem<SimplePayload> item = new PayloadItem<SimplePayload>("A7",spa); node.send(item);
Listening and subscription :
LeafNode node = pm.getNode("sameh");
node.addItemEventListener(new ItemEventListener<Item>() {
public void handlePublishedItems(ItemPublishEvent<Item> items) {
System.out.println("items count --- " + items.getItems().size());
List<Item> its = items.getItems();
Item i = its.get(0);
System.out.println(i.toXML());
}
});
node.subscribe("admin@sameh-desktop");
Every time I login, this listener works and notify me with the same item I saw before.
Is there a way to prevent receiving the the same notification ?
I know that I can ignore the notifaction I saw accourding to my local db (or somehow).
But I need to find a way to prevent the server to send me the same notifcation in order to maintain the bandwidth.