Search code examples
azure-iot-hubazure-iot-edgeazure-iot-sdk

Does Azure IoT Edge module receive a twin patch when it starts up?


Is it normal for an IoT Edge Module to receive a twin patch everytime it starts up?

Imagine this scenario:

  • IoT edge is configured in an On-prem VM
  • A property is added into example_module's twin desired properties
  • example_module receives a patch and sets its environmental variables based on the patch received and reports back the properties
  • example_module crashes due to an unrelated issue and restarts

Does example_module receive a patch when it starts up after the crash?


Solution

  • Yes, that's exactly what happens.

    The scenario you described the example_module restarts after a crash, it would receive a patch containing the latest desired properties. The IoT Edge runtime maintains the desired properties state for each module, and when a module starts or restarts, it syncs up its state with the desired properties from the edgeAgent. This behaviour ensures the module is always in sync with the desired state defined in its module twin, even after crashes or restarts.