'How to get "Total number of messages on the IoT Hub exceeded the allocated quota" message from Azure iot sdk c
I'm using Azure iot sdk c, sometimes my iothub service can reach to maximum quota, I can see connection error or backend can't get data, but not able to obviously check if the connection error is because of maximum quota reached.
In the meantime, I can see below logs from SDK, but not sure if up layer can get this messages:
{true,2,NULL,true,* {* {amqp:resource-limit-exceeded,Total number of messages on the IoT Hub exceeded the allocated quota. Increase units for this hub to increase the quota. For more information on quota, please refer to: https://aka.ms/iothubthrottling,{[com.microsoft:tracking-id:6c35054a81b04a5a81ae292a6ab0a7c1-G:0-TimeStamp:03/12/2022 07:46:09],[com.microsoft:is-filtered:true]}}},NULL}
I am keen to know if application layer can get this reason from ampq response.
Solution 1:[1]
You did not mention which pricing tier you are using. The message size used to calculate the daily quota is 0.5 KB for a free tier hub and 4KB for all other tiers. S1 version is capable of receiving 400.000 D2C messages a day of size 4KB, the free tier support 8000 messages of size 0.5 KB. Sending C2D messages and Device provisioning is also part of this amount.
The tier and number of units determine the maximum daily quota of messages that you can send. Please see IoT Hub quotas and throttling for more details.
I am keen to know if application layer can get this reason from ampq response.
I would suggest you check Azure IoT device SDK for C – more about IoTHubClient for more details on Message handling.
At any given time, you can increase quotas or throttle limits by increasing the number of provisioned units in an IoT hub.
sendMessageAsync method throws timeout exception in case your message sending fails, unless you have some kind of retry policies implemented(according to the documentation C SDK does not allow custom retry policies https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-reliability-features-in-sdks#retry-patterns).
The SDKs provide three retry policies:
Exponential back-off with jitter: This default retry policy tends to be aggressive at the start and slow down over time until it reaches a maximum delay. The design is based on Retry guidance from Azure Architecture Center.
Custom retry: For some SDK languages, you can design a custom retry policy that is better suited for your scenario and then inject it into the RetryPolicy. Custom retry isn't available on the C SDK, and it is not currently supported on the Python SDK. The Python SDK reconnects as-needed.
No retry: You can set retry policy to "no retry," which disables the retry logic. The SDK tries to connect once and send a message once, assuming the connection is established. This policy is typically used in scenarios with bandwidth or cost concerns. If you choose this option, messages that fail to send are lost and can't be recovered.
Solution 2:[2]
Answering the question myself. MS team added the support in the latest version of the Azure IoT SDK C. that's a fantastic support. appreciate!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | halfer |
| Solution 2 | Felix Zhang |
