I am facing a dilemma with my code, My problem statement is that when I am sending JSon to Azure Service Bus through this piece of code
BrokeredMessage message = new BrokeredMessage(jsonStr);
and printing the JSON in Sender code , through
System.out.println("Json---"+jsonStr);
This is working fine. But when I am receiving the JSON list from Queue through the same Azure Service Bus , I am able to receive it but some repeated end fields are getting appended after the JSOn list completion. I am using this below piece of code :
if (message != null && message.getMessageId() != null)
{
System.out.println("MessageID: " + message.getMessageId());
// Display the queue message.
System.out.print("From queue: ");
byte[] b = new byte[200];
String s = null;
int numRead = message.getBody().read(b);
System.out.println("numread--"+numRead);
while (-1 != numRead)
{
s = new String(b);
s = s.trim();
System.out.print(s);
numRead = message.getBody().read(b);
//System.out.println("numread--"+numRead);
}
}
And the output I am getting with repeated fields appended at the end :
"oldPartNumber": null,
"materialType": "4",
"materialGroup": "HX",
"bulkItemFlag": "N",
"flexStringCollab04": null,
"flexStringCollab05": null,
"blockShipments": null,
"earlyShipmentTolerance": 0,
"overShipmentTolerance": 0.0,
"priceMismatchToleranceMin": 0.0,
"priceMismatchToleranceMax": 0.0
}
}
],
"grFF": null
}ingCollab04":null,"flexStringCollab05":null,"blockShipments":null,"earlyShipmentTolerance":0,"overShipmentTolerance":0.0,"priceMismatchToleranceMin":0.0,"priceMismatchTo
You can see last few fields are repeated in output even after the completion of JSOn List from the queue. I have not pasted the whole JSOn as problem is at the end only and my JSOn LISt is somehow contains more fields. I want to eliminate this problem.
Any help appreciated. Thanks in advance