Service Bus Error: The maximum entity size has been reached or exceeded for Topic
One of my customer suddenly started seeing the following error message:
Microsoft.ServiceBus.Messaging.QuotaExceededExceptionMessage: The maximum entity size has been reached or exceeded for Topic: 'xxx-xxx-xxx'. Size of entity in bytes:1073742326, Max entity size in bytes:
1073741824..TrackingId:xxxxxxxxxxxxxxxxxxxxxxxxxx, TimeStamp:6/30/2013 7:50:18 AM
What went wrong?
Luckily this error was self-explanatory and indicating that the Max Topic size is 1 GB (1073741824 bytes) while the Topic is already utilized 1073742326 bytes which translates to approx 1 GB limit. We logged into the Azure Portal and verified the same. Next we ran Service Bus Explorer to check the status of the messages. We saw thousands of messages are in the Topics.
Why messages were not getting cleared from the Topic?
Now the obvious question arise, what is keeping those thousands of message in topic. After some investigation we found that "Default Message Time to Live" for Topic was set to very high number. In this case it was set to 1 year. In order to fix the issue, we set "Default Message Time to Live" to 2 days as recommended by the their App Developer. This resolved the issue. Here is a screen-shot of the configuration from Azure Management Portal: