-
Notifications
You must be signed in to change notification settings - Fork 225
Consolidate module sample into one, and add reconnection logic #151
Conversation
ContentType = "application/json", | ||
}; | ||
|
||
await moduleClient.SendEventAsync(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth talking about which classes of exceptions one might expect, and what app behavior is required based on that. Meaning, you might retry, reinit your client, or quit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, how about I add a link to our sample where we handle the most common cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We touch on those in the section "Module reconnection" below. I feel that if we add those instructions here again, it might be repetitive.
I don't necessarily want to list exceptions based on operation - i.e. you might see these exceptions while sending telemetry - since the list might not be exhaustive (we'd don't have an operation: exception mapping yet).
Thoughts?
What samples were consolidated? |
I lament we copy code from another sample, meaning we'll need to update it in multiple places. What do you think about making a sample helper library for common stuff? |
The module messaging sample, and the module twin sample. |
iot-hub/Samples/module/ModuleSample/Logging/ColorConsoleLogger.cs
Outdated
Show resolved
Hide resolved
I totally agree, although, we might be better off consolidating it as a part of the "samples-refresh", what do you think?
I think we might come up with more ideas as we clean up the samples, and that might help us in getting to a better (more efficient/ cleaner) approach. |
iot-hub/Samples/module/ModuleSample/Logging/ColorConsoleLogger.cs
Outdated
Show resolved
Hide resolved
…-Samples#151) * samples(iot-device): Consolidate module sample into one, and add reconnection logic
Link to readme: https://github.com/Azure-Samples/azure-iot-samples-csharp/tree/abmisr/moduleSample/iot-hub/Samples/module/ModuleSample
The reconnection logic and sample structure is the same as the DeviceReconnectionSample. I've added some additional setup info and code snippet into the readme (to help people who simply want to check the API usage, and not a complete module simulation).