Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 369
Chetan Bhoyar Avatar asked Nov 01 '22 10:11

Chetan Bhoyar


1 Answers

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));

like image 78
Chetan Bhoyar Avatar answered Nov 10 '22 00:11

Chetan Bhoyar