Skip to content

Commit 01c53e0

Browse files
authored
Merge pull request #222275 from KennedyDMSFT/US44747-04
December freshness (4/11)
2 parents 8a1fda1 + f5e9d0d commit 01c53e0

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.author: kgremban
77
ms.service: iot-hub
88
services: iot-hub
99
ms.topic: conceptual
10-
ms.date: 03/15/2018
10+
ms.date: 12/20/2022
1111
ms.custom: mqtt, devx-track-azurecli
1212

1313
---
@@ -22,44 +22,44 @@ You send cloud-to-device messages through a service-facing endpoint, */messages/
2222

2323
To target each cloud-to-device message at a single device, your IoT hub sets the **to** property to */devices/{deviceId}/messages/devicebound*.
2424

25-
Each device queue holds, at most, 50 cloud-to-device messages. To try to send more messages to the same device results in an error.
25+
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.
2626

2727
## The cloud-to-device message life cycle
2828

29-
To guarantee at-least-once message delivery, your IoT hub persists cloud-to-device messages in per-device queues. For the IoT hub to remove the messages from the queue, the devices must explicitly acknowledge *completion*. This approach guarantees resiliency against connectivity and device failures.
29+
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.
3030

3131
The life-cycle state graph is displayed in the following diagram:
3232

33-
![Cloud-to-device message life cycle](./media/iot-hub-devguide-messages-c2d/lifecycle.png)
33+
:::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.":::
3434

3535
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*.
3636

3737
A device can also:
3838

39-
* *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.
39+
* *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.
4040

41-
* *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.
41+
* *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.
4242

4343
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.
4444

45-
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 [Time to live](#message-expiration-time-to-live).
45+
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).
4646

4747
The [How to send cloud-to-device messages with IoT Hub](iot-hub-csharp-csharp-c2d.md) article shows you how to send cloud-to-device messages from the cloud and receive them on a device.
4848

49-
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 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:
49+
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:
5050

5151
* Complete the cloud-to-device message after the device has persisted the task description in local storage.
5252

5353
* Notify the solution back end with one or more device-to-cloud messages at various stages of progress of the task.
5454

5555
## Message expiration (time to live)
5656

57-
Every cloud-to-device message has an expiration time. This time is set by either of the following:
57+
Every cloud-to-device message has an expiration time. This time is set by either of the following options:
5858

5959
* The **ExpiryTimeUtc** property in the service
6060
* The IoT hub, by using the default *time to live* that's specified as an IoT hub property
6161

62-
See [Cloud-to-device configuration options](#cloud-to-device-configuration-options).
62+
For more information about message expiration, see [Cloud-to-device configuration options](#cloud-to-device-configuration-options).
6363

6464
A common way to take advantage of a message expiration and to avoid sending messages to disconnected devices is to set short *time to live* values. This approach achieves the same result as maintaining the device connection state, but it is more efficient. When you request message acknowledgments, the IoT hub notifies you which devices are:
6565

@@ -68,41 +68,41 @@ A common way to take advantage of a message expiration and to avoid sending mess
6868

6969
## Message feedback
7070

71-
When you send a cloud-to-device message, the service can request the delivery of per-message feedback about the final state of that message. You do this by setting the **iothub-ack** application property in the cloud-to-device message that's being sent to one of the following four values:
71+
When you send a cloud-to-device message, the service can request the delivery of per-message feedback about the final state of that message. You can configure message feedback by setting the **iothub-ack** application property in the cloud-to-device message that's being sent to one of the following four values:
7272

7373
| Ack property value | Behavior |
7474
| ------------ | -------- |
75-
| none | The IoT hub doesn't generate a feedback message (default behavior). |
75+
| none | Default. The IoT hub doesn't generate a feedback message. |
7676
| positive | If the cloud-to-device message reaches the *Completed* state, the IoT hub generates a feedback message. |
7777
| negative | If the cloud-to-device message reaches the *Dead lettered* state, the IoT hub generates a feedback message. |
7878
| full | The IoT hub generates a feedback message in either case. |
7979

80-
If the **Ack** value is *full*, and you don't receive a feedback message, it means that the feedback message has expired. The service can't know what happened to the original message. In practice, a service should ensure that it can process the feedback before it expires. The maximum expiration time is two days, which leaves time to get the service running again if a failure occurs.
80+
If the **Ack** property value is set to *full*, and you don't receive a feedback message, it means that the feedback message has expired. The service can't know what happened to the original message. In practice, a service should ensure that it can process the feedback before it expires. The maximum expiration time is two days, which leaves time to get the service running again if a failure occurs.
8181

8282
As explained in [Endpoints](iot-hub-devguide-endpoints.md), the IoT hub delivers feedback through a service-facing endpoint, */messages/servicebound/feedback*, as messages. The semantics for receiving feedback are the same as for cloud-to-device messages. Whenever possible, message feedback is batched in a single message, with the following format:
8383

8484
| Property | Description |
8585
| ------------ | ----------- |
86-
| EnqueuedTime | A timestamp that indicates when the feedback message was received by the hub |
86+
| EnqueuedTime | A timestamp that indicates when the feedback message was received by the hub. |
8787
| UserId | `{iot hub name}` |
8888
| ContentType | `application/vnd.microsoft.iothub.feedback.json` |
8989

90-
The system will send out the feedback either when the batch reaches to 64 messages, or in 15 seconds from last sent, whichever come first.
90+
The system will send out the feedback either when the batch reaches to 64 messages, or in 15 seconds from last sent, whichever comes first.
9191

9292
The body is a JSON-serialized array of records, each with the following properties:
9393

9494
| Property | Description |
9595
| ------------------ | ----------- |
96-
| enqueuedTimeUtc | A timestamp that indicates when the outcome of the message happened (for example, the hub received the feedback message or the original message expired) |
97-
| originalMessageId | The *MessageId* of the cloud-to-device message to which this feedback information relates |
96+
| enqueuedTimeUtc | A timestamp that indicates when the outcome of the message happened. For example, a timestamp that indicates when the hub received the feedback message or the original message expired. |
97+
| originalMessageId | The *MessageId* of the cloud-to-device message to which this feedback information relates. |
9898
| statusCode | A required string, used in feedback messages that are generated by the IoT hub: <br/> *Success* <br/> *Expired* <br/> *DeliveryCountExceeded* <br/> *Rejected* <br/> *Purged* |
99-
| description | String values for *StatusCode* |
100-
| deviceId | The *DeviceId* of the target device of the cloud-to-device message to which this piece of feedback relates |
101-
| deviceGenerationId | The *DeviceGenerationId* of the target device of the cloud-to-device message to which this piece of feedback relates |
99+
| description | String values for *StatusCode*. |
100+
| deviceId | The *DeviceId* of the target device of the cloud-to-device message to which this piece of feedback relates. |
101+
| deviceGenerationId | The *DeviceGenerationId* of the target device of the cloud-to-device message to which this piece of feedback relates. |
102102

103-
For the cloud-to-device message to correlate its feedback with the original message, the service must specify a *MessageId*.
103+
The service must specify a *MessageId* so that the cloud-to-device message can correlate its feedback with the original message.
104104

105-
The body of a feedback message is shown in the following code:
105+
The body of a feedback message is shown in the following code example:
106106

107107
```json
108108
[
@@ -123,7 +123,7 @@ The body of a feedback message is shown in the following code:
123123

124124
**Pending feedback for deleted devices**
125125

126-
When a device is deleted, any pending feedback is deleted as well. Device feedback is sent in batches. If a device is deleted in the narrow window (often less than 1 second) between when the device confirms receipt of the message and when the next feedback batch is prepared, the feedback will not occur.
126+
When a device is deleted, any pending feedback is deleted as well. Device feedback is sent in batches. A narrow window, often less than one second, can occur between when a device confirms receipt of the message and when the next feedback batch is prepared. If a device is deleted in that narrow window, the feedback doesn't occur.
127127

128128
You can address this behavior by waiting a period of time for pending feedback to arrive before deleting your device. Related message feedback should be assumed lost once a device is deleted.
129129

@@ -133,11 +133,11 @@ Each IoT hub exposes the following configuration options for cloud-to-device mes
133133

134134
| Property | Description | Range and default |
135135
| ------------------------- | ----------- | ----------------- |
136-
| defaultTtlAsIso8601 | Default TTL for cloud-to-device messages | ISO_8601 interval up to 2 days (minimum 1 minute); default: 1 hour |
136+
| defaultTtlAsIso8601 | Default TTL for cloud-to-device messages | ISO_8601 interval up to two days (minimum one minute); default: one hour |
137137
| maxDeliveryCount | Maximum delivery count for cloud-to-device per-device queues | 1 to 100; default: 10 |
138-
| feedback.ttlAsIso8601 | Retention for service-bound feedback messages | ISO_8601 interval up to 2 days (minimum 1 minute); default: 1 hour |
138+
| feedback.ttlAsIso8601 | Retention for service-bound feedback messages | ISO_8601 interval up to two days (minimum one minute); default: one hour |
139139
| feedback.maxDeliveryCount | Maximum delivery count for the feedback queue | 1 to 100; default: 10 |
140-
| feedback.lockDurationAsIso8601 | Lock duration for the feedback queue | ISO_8601 interval from 5 to 300 seconds (minimum 5 seconds); default: 60 seconds. |
140+
| feedback.lockDurationAsIso8601 | Lock duration for the feedback queue | ISO_8601 interval from 5 to 300 seconds (minimum five seconds); default: 60 seconds. |
141141

142142
You can set the configuration options in one of the following ways:
143143

@@ -166,6 +166,6 @@ You can set the configuration options in one of the following ways:
166166
167167
## Next steps
168168
169-
For information about the SDKs that you can use to receive cloud-to-device messages, see [Azure IoT SDKs](iot-hub-devguide-sdks.md).
169+
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).
170170
171171
To try out receiving cloud-to-device messages, see the [Send cloud-to-device](iot-hub-csharp-csharp-c2d.md) tutorial.

0 commit comments

Comments
 (0)