Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
587 stars 740 forks source link

can we configure/set IOTHUB_CLIENT_RETRY_INTERVAL default 5secs to any other value #2430

Closed Dasthananda closed 1 year ago

Dasthananda commented 1 year ago

We are using the azure-iot-sdk -c LTS_07_2022_Ref01 version.

can we configure/set IOTHUB_CLIENT_RETRY_INTERVAL default 5secs to any other value (7,8,9sec) ,if its possible with azure-iot-sdk -c could you please provide sample code/api to use the same.

Thanks

cabrillosa commented 1 year ago

@Dasthananda I think you can set the number of seconds between retries by setting the option "OPTION_RETRY_INTERVAL_SEC". For more information, please refer to this reference document:

https://github.com/Azure/azure-iot-sdk-c/blob/main/doc/Iothub_sdk_options.md#:~:text=%22retry_interval_sec%22

CIPop commented 1 year ago

Thank you @cabrillosa !

@Dasthananda , you can achieve the same effect using IoTHubDeviceClient_SetRetryPolicy. These are documented in https://github.com/Azure/azure-iot-sdk-c/blob/main/doc/connection_and_messaging_reliability.md#connection-retry-policies

We recommend using defaults in most cases as they have been tried with large scale device deployments.

If you would like to switch to a constant retry interval of 7 seconds, the call should be: IoTHubDeviceClient_SetRetryPolicy(IOTHUB_CLIENT_RETRY_INTERVAL, 7);

Dasthananda commented 1 year ago

Thanks @cabrillosa ,@CIPop