Skip to content

Commit 66ecad5

Browse files
Merge pull request #284671 from kgremban/aug14-hubfreshness
Hub freshness - index; devguide-c2d
2 parents c3e1132 + 89f14cd commit 66ecad5

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

articles/iot-hub/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
ms.topic: landing-page
99
author: kgremban
1010
ms.author: kgremban
11-
ms.date: 04/05/2022
11+
ms.date: 08/14/2024
1212

1313
landingContent:
1414
- title: Learn about IoT Hub

articles/iot-hub/iot-hub-devguide-messages-c2d.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ author: kgremban
66
ms.author: kgremban
77
ms.service: iot-hub
88
ms.topic: concept-article
9-
ms.date: 12/20/2022
9+
ms.date: 08/14/2024
1010
ms.custom: mqtt, devx-track-azurecli
1111
---
1212

13-
# Send cloud-to-device messages from an IoT hub
13+
# Understand cloud-to-device messaging from an IoT hub
1414

15-
To send one-way notifications to a device app from your solution back end, send cloud-to-device messages from your IoT hub to your device. For a discussion of other cloud-to-device options supported by Azure IoT Hub, see [Cloud-to-device communications guidance](iot-hub-devguide-c2d-guidance.md).
15+
Cloud-to-device messages are one-way notifications from your solution back end to a device application. For a discussion of other cloud-to-device options supported by Azure IoT Hub, see [Cloud-to-device communications guidance](iot-hub-devguide-c2d-guidance.md).
1616

1717
[!INCLUDE [iot-hub-basic](../../includes/iot-hub-basic-whole.md)]
1818

@@ -22,27 +22,28 @@ To target each cloud-to-device message at a single device, your IoT hub sets the
2222

2323
Each device queue holds, at most, 50 cloud-to-device messages. An error occurs if you try to send more messages to the same device.
2424

25+
This article discusses the concepts and processes around cloud-to-device messages. For guidance on developing applications that handle cloud-to-device messages, see [Send and receive cloud-to-device messages](how-to-cloud-to-device-messaging.md).
26+
27+
2528
## The cloud-to-device message life cycle
2629

2730
To guarantee at-least-once message delivery, your IoT hub persists cloud-to-device messages in per-device queues. Devices must explicitly acknowledge *completion* of a message before the IoT hub removes the message from the queue. This approach guarantees resiliency against connectivity and device failures.
2831

29-
The life-cycle state graph is displayed in the following diagram:
32+
The life cycle state graph is displayed in the following diagram:
3033

31-
:::image type="content" source="./media/iot-hub-devguide-messages-c2d/lifecycle.png" alt-text="Diagram showing the life-cycle state graph of cloud-to-device messages.":::
34+
:::image type="content" source="./media/iot-hub-devguide-messages-c2d/lifecycle.png" alt-text="Diagram showing the life cycle state graph of cloud-to-device messages.":::
3235

33-
When the IoT hub service sends a message to a device, the service sets the message state to *Enqueued*. When a device wants to *receive* a message, the IoT hub *locks* the message by setting the state to *Invisible*. This state allows other threads on the device to start receiving other messages. When a device thread completes the processing of a message, it notifies the IoT hub by *completing* the message. The IoT hub then sets the state to *Completed*.
36+
When the IoT hub service sends a message to a device, the service sets the message state to *Enqueued*. When a device thread is ready to receive a message, the IoT hub locks the message by setting the state to *Invisible*. This state allows other threads on the device to start receiving other messages. When a device thread completes the processing of a message, it notifies the IoT hub by completing the message. The IoT hub then sets the state to *Completed*.
3437

3538
A device can also:
3639

37-
* *Reject* the message, which causes the IoT hub to set it to the *Dead lettered* state. Devices that connect over the Message Queuing Telemetry Transport (MQTT) protocol can't reject cloud-to-device messages.
40+
* *Reject* the message, which causes the IoT hub to set it to the *Dead lettered* state. There is no dead letter queue for recovering these messages. Devices that connect over the Message Queuing Telemetry Transport (MQTT) protocol can't reject cloud-to-device messages.
3841

3942
* *Abandon* the message, which causes the IoT hub to put the message back in the queue, with the state set to *Enqueued*. Devices that connect over the MQTT protocol can't abandon cloud-to-device messages.
4043

41-
A thread could fail to process a message without notifying the IoT hub. In this case, messages automatically transition from the *Invisible* state back to the *Enqueued* state after a *visibility* time-out (or *lock* time-out). The value of this time-out is one minute and cannot be changed.
42-
43-
The **max delivery count** property on the IoT hub determines the maximum number of times a message can transition between the *Enqueued* and *Invisible* states. After that number of transitions, the IoT hub sets the state of the message to *Dead lettered*. Similarly, the IoT hub sets the state of a message to *Dead lettered* after its expiration time. For more information, see [Message expiration (time to live)](#message-expiration-time-to-live).
44+
A thread could fail to process a message without notifying the IoT hub. In this case, messages automatically transition from the *Invisible* state back to the *Enqueued* state after a visibility time-out (or lock time-out). The length of this time-out is one minute and cannot be changed.
4445

45-
The [How to send cloud-to-device messages with IoT Hub](c2d-messaging-dotnet.md) article shows you how to send cloud-to-device messages from the cloud and receive them on a device.
46+
The **max delivery count** property on the IoT hub determines the maximum number of times a message can transition between the *Enqueued* and *Invisible* states. After that number of transitions, the IoT hub sets the state of the message to *Dead lettered*. Similarly, the IoT hub sets the state of a message to *Dead lettered* after its expiration time.
4647

4748
A device ordinarily completes a cloud-to-device message when the loss of the message doesn't affect the application logic. An example of this completion might be when the device has persisted the message content locally or has successfully executed an operation. The message could also carry transient information, whose loss wouldn't impact the functionality of the application. Sometimes, for long-running tasks, you can:
4849

@@ -137,11 +138,11 @@ Each IoT hub exposes the following configuration options for cloud-to-device mes
137138
| feedback.maxDeliveryCount | Maximum delivery count for the feedback queue | 1 to 100; default: 10 |
138139
| feedback.lockDurationAsIso8601 | Lock duration for the feedback queue | ISO_8601 interval from 5 to 300 seconds (minimum five seconds); default: 60 seconds. |
139140

140-
You can set the configuration options in one of the following ways:
141+
You can set the configuration options in the Azure portal or Azure CLI:
141142

142143
* **Azure portal**: Under **Hub settings** on your IoT hub, select **Built-in endpoints** and go to **Cloud to device messaging**. (Setting the **feedback.maxDeliveryCount** and **feedback.lockDurationAsIso8601** properties is not currently supported in Azure portal.)
143144

144-
:::image type="content" source="./media/iot-hub-devguide-messages-c2d/c2d-configuration-portal.png" alt-text="Set configuration options for cloud-to-device messaging in the portal" border="true":::
145+
:::image type="content" source="./media/iot-hub-devguide-messages-c2d/c2d-configuration-portal.png" alt-text="Set configuration options for cloud-to-device messaging in the portal" border="true":::
145146

146147
* **Azure CLI**: Use the [az iot hub update](/cli/azure/iot/hub#az-iot-hub-update) command:
147148

@@ -164,6 +165,6 @@ You can set the configuration options in one of the following ways:
164165
165166
## Next steps
166167
167-
For information about the SDKs that you can use to receive cloud-to-device messages, see [Azure IoT Hub SDKs](iot-hub-devguide-sdks.md).
168+
For information about the SDKs that you can use to handle cloud-to-device messages, see [Azure IoT Hub SDKs](iot-hub-devguide-sdks.md).
168169
169-
To try out receiving cloud-to-device messages, see the [Send cloud-to-device](c2d-messaging-dotnet.md) tutorial.
170+
For guidance on developing applications that handle cloud-to-device messages, see [Send and receive cloud-to-device messages](how-to-cloud-to-device-messaging.md).

0 commit comments

Comments
 (0)