I am trying to receive Azure Queue Message from Java. I am able to receive message using BrokeredMessage in java. (I am a novice to java).
My problem is message.getBody() is returning some header information as well (Not just the message as I need).
I get
string3http://schemas.mi@string3http://schemas.microsoft.com/2003/10/Serialization/?? message appended with my body in front of it. How can I get rid of this header information.
And I also I noticed I get the message in two batches. (Not the whole lot at once)
My first batch of message.getBody()returns below message'@string3http://schemas.mi'MySecond batch of message.getBody()returns below message@crosoft.com/2003/10/Serialization/??+My actual message.
MY total message size is less than 500B, But I have set byte size to 4096. So is not splinting because of the size issue.
This is the receiver code I use.
ReceiveMessageOptions opts =ReceiveMessageOptions.DEFAULT;
opts.setReceiveMode(ReceiveMode.PEEK_LOCK);while(true){ReceiveQueueMessageResult resultQM =
service.receiveQueueMessage("MyqueueName", opts);BrokeredMessage message = resultQM.getValue();if(message !=null&& message.getMessageId()!=null){byte[] b =newbyte[4096];String s =null;int numRead = message.getBody().read(b);while(-1!= numRead){
s =newString(b);
s = s.trim();System.out.print(s);
numRead = message.getBody().read(b);}}}
This is the total output of System.out.print(s);. (But in two batches as I mentioned before)
string3http://schemas.microsoft.com/2003/10/Serialization/??+ My actual message.
Any Help is much appreciated!
Bn