Chetan Bhoyar
Chetan Bhoyar

Reputation: 511

How to send / receive customize item payload on pubsub node

How to send / receive customize item on pubsub node with payload, I am using qsmack lib.

here is my code.

StringBuilder strBuffer = new StringBuilder();  
strBuffer.append("<x xmlns=");
strBuffer.append("jabber:x:data");
strBuffer.append(">Test</x>");      
String xml = strBuffer.toString();

SimplePayload item = new SimplePayload("test1111","pubsub_test_book", xml);

// Publish an Item with payload

leafNode.send(new PayloadItem<SimplePayload>("test123", item));

when I am trying to send payload item on node, I got an error message from server no response from server and connection disconnected.

Upvotes: 5

Views: 711

Answers (1)

Chetan Bhoyar
Chetan Bhoyar

Reputation: 511

After long try , I found answer how to send and receive payload on pub sub node. While creating pubsub node I am using ConfigureForm, that will create a problem in my case. So I am creating node without configuration form.

mLeafNode = (LeafNode) mPubSubManager.createNode(nodeId);

It will solved my problem. Now I can send and receive payload item.

SimplePayload item = new SimplePayload("test1111","pubsub_test_book", xml_string);

leafNode.send(new PayloadItem("test123", item));

Upvotes: 2

Related Questions