I was wondering if IoThub informs the device if the event grid message fails? Here is the architecture flow:
Device->IoTHub->EventGrid->Webhook
So when the EevntGrid gets some error(like 400/500 error due to some reason), does IoThub inform the device of this failure when the device could retry, or does it send a message received where the device will think the message has been sent successfully to the Webhook? Is there a workflow/ design where we could inform the device of this error?
So when the EevntGrid gets some error(like 400/500 error due to some reason), does IoThub inform the device of this failure when the device could retry, or does it send a message received where the device will think the message has been sent successfully to the Webhook?
No, it is an asynchronous flow. There won't be any cloud-to-device message that tells the device thing have failed. At least not out-of-the-box. Also, the retry logic is already present in the Event Grid, no need for the device to retry the message unless it fails to communicate with the IoT Hub.
Is there a workflow/ design where we could inform the device of this error?
Take this example:
Now, the cloud-to-device message can only be send at step 6 (or 7 if you want to include the response of the final endpoint). There might be milliseconds between step 1 and 6/7 or there might be minutes, hours or even days (in worst case scenarios, depending on the retry configuration and endpoint status).
A logical thing is to have the endpoint publish its own event and get it delivered to the cloud device, but this will be an asynchronous flow.
Why do you want to burden the device with the outcome of the message delivery? I think it shouldn't have to worry about the flow unless it fails to communicate with the IoT Hub.