Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Messages cannot be larger than 65536 bytes

I'm using Azure Queue to send emails. But for last time I'm getting exception about queue size limit up to 65536 bytes even after cheking the message size.

enter image description here

like image 705
Roman Borovets Avatar asked Sep 16 '16 10:09

Roman Borovets


2 Answers

While it is true that the maximum size of a message can be 64KB however Azure uses UTF16 encoding to store the data thus for each byte of data that you provide, Azure Storage uses 2 bytes to store that data.

What this means is that you can essentially store up to 32KB of data in a message in an Azure Queue. Because you're exceeding this 32KB limit, you're getting this error.

like image 141
Gaurav Mantri Avatar answered Sep 28 '22 22:09

Gaurav Mantri


A string message will be Base64 encoded before being sent thus increasing it's length by about a third.

Therefore the maximum length of message string you can submit is 49152 which equates to 65536, the maximum allowed.

The formula for calculating the Base64 encoded length can be found here: https://stackoverflow.com/a/13378842/5836877

like image 30
JamesP Avatar answered Sep 29 '22 00:09

JamesP