Setting Maximum MessageCount to unlimited.



I am trying to develop an edge module to work as a gateway for my BLE peripherals. I have followed c samples from azure samples and developed a customized module and I can see in all references message count is set as MESSAGE_COUNT 500.

I am trying to remove this and make the count to unlimited. From some of the discussions I found ,it can be achieved by setting environment variable "MessageCount" to -1. I have tried the same with the simulated temperature sensor module and it is sending more than 500 messages .

But when I tried to do the same with my custom module (which is having a infinite loop for sending),it is stopping at random. I could see a maximum of 960. Attaching screenshot of my setting and sim temp module data.


Please help me to understand how can I achieve unlimited message sending from a module. Is there any settings to be done or any code change is required?.

I am using Raspberry pi 4b ,c code ,iotedge 1.2 and 1.1.


Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
548 questions
{count} votes

1 answer

Sort by: Most helpful
  1. António Sérgio Azevedo 7,666 Reputation points Microsoft Employee

    Hello @Syam Krishnanmanimalakalathilunnikrishnan(UST,IN) ,

    It looks like you are configuring the Environment Variable correctly and that shouldn't be the issue...

    What is the IoTHub Tier you are using? Do you receive any error at device side?

    See: Reference - IoT Hub quotas and throttling

    When the module stops sending messages, go and view the module logs in the portal - do you see any error? After that when you restart the module, are messages starting to be sent again?

    Finally, have a look at Common Errors | Stability issues on smaller devices page.

    "You may experience stability problems on resource constrained devices like the Raspberry Pi, especially when used as a gateway. Symptoms include out of memory exceptions in the IoT Edge hub module, downstream devices failing to connect, or the device failing to send telemetry messages after a few hours."

    Go and set the environment variable OptimizeForPerformance to false. Do you see any improvement?




    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.