Azure : A General Service Bus Queue Message Serialization Issue and Solution

Most of the times we do work with Enterprise systems, and take Azure Service Bus as a candidate mediator between messaging systems. You might have come across a problem if you have worked with messaging systems that provide MQTT/AMQP messages, whilst the REST API of the Service Bus is wrapped in Node JS which runs on HTTP protocol.

In the above mentioned case, when you receive the message from JMS / your messaging system, you should have noticed a “@\u0006string\b3\u0001” has been appended in-front of the actual message, when you decode the message from base64. This would be more annoying of the message is a JSON message, it you would have faced JSON parsing issues.

To avoid this problem, you can simply route the message via Azure Stream Analytics, and set its compatibility level to 1.1 (For Azure Stream Analytics, compatibility level 1.0 is the default one). With the later compatibility level, the messages content contains the stream directly with no additional tags where as the previous version used DataContractSerializer, so the message content included XML tags.



Happy Coding.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s