Skip to content

Commit 19b8963

Browse files
committed
Address supportability issue 6464302 lack of clarity on how c2d messages could be used as a stream
1 parent 041b42f commit 19b8963

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

articles/iot-hub/iot-hub-csharp-csharp-c2d.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,20 @@ In this section, modify the device app you created in [Send telemetry from a dev
8181

8282
The `ReceiveAsync` method asynchronously returns the received message at the time that it is received by the device. It returns *null* after a specifiable timeout period. In this example, the default of one minute is used. When the app receives a *null*, it should continue to wait for new messages. This requirement is the reason for the `if (receivedMessage == null) continue` line.
8383

84-
The call to `CompleteAsync()` notifies IoT Hub that the message has been successfully processed. The message can be safely removed from the device queue. If something happened that prevented the device app from completing the processing of the message, IoT Hub delivers it again. The message processing logic in the device app must be *idempotent*, so that receiving the same message multiple times produces the same result.
84+
The call to `CompleteAsync()` notifies IoT Hub that the message has been successfully processed and that the message can be safely removed from the device queue. The device should call this method when its processing successfully completes regardless of the protocol it's using.
8585

86-
An application can also temporarily abandon a message, which results in IoT hub retaining the message in the queue for future consumption. Or the application can reject a message, which permanently removes the message from the queue. For more information about the cloud-to-device message lifecycle, see [D2C and C2D messaging with IoT Hub](iot-hub-devguide-messaging.md).
86+
With AMQP and HTTPS, but not MQTT, the device can also:
8787

88-
> [!NOTE]
89-
> When using HTTPS instead of MQTT or AMQP as a transport, the `ReceiveAsync` method returns immediately. The supported pattern for cloud-to-device messages with HTTPS is intermittently connected devices that check for messages infrequently (less than every 25 minutes). Issuing more HTTPS receives results in IoT Hub throttling the requests. For more information about the differences between MQTT, AMQP and HTTPS support, and IoT Hub throttling, see [D2C and C2D messaging with IoT Hub](iot-hub-devguide-messaging.md).
90-
>
88+
* Abandon a message, which results in IoT Hub retaining the message in the device queue for future consumption.
89+
* Reject a message, which which permanently removes the message from the device queue.
90+
91+
If something happens that prevents the device from completing, abandoning, or rejecting the message, IoT Hub will, after a fixed timeout period, queue the message for delivery again. For this reason, the message processing logic in the device app must be *idempotent*, so that receiving the same message multiple times produces the same result.
92+
93+
For more detailed information about how IoT Hub processes cloud-to-device messages, including details of the cloud-to-device message lifecycle, see [Send cloud-to-device messages from an IoT hub](iot-hub-devguide-messages-c2d.md).
94+
95+
> [!NOTE]
96+
> When using HTTPS instead of MQTT or AMQP as a transport, the `ReceiveAsync` method returns immediately. The supported pattern for cloud-to-device messages with HTTPS is intermittently connected devices that check for messages infrequently (a minimum of every 25 minutes). Issuing more HTTPS receives results in IoT Hub throttling the requests. For more information about the differences between MQTT, AMQP, and HTTPS support, see [Cloud-to-device communications guidance](iot-hub-devguide-c2d-guidance.md) and [Choose a communication protocol](iot-hub/iot-hub-devguide-protocols.md).
97+
>
9198
9299
## Get the IoT hub connection string
93100

articles/iot-hub/iot-hub-java-java-c2d.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,26 @@ In this section, you modify the simulated device app you created in [Send teleme
8080
client.open();
8181
```
8282

83-
> [!NOTE]
84-
> If you use HTTPS instead of MQTT or AMQP as the transport, the **DeviceClient** instance checks for messages from IoT Hub infrequently (less than every 25 minutes). For more information about the differences between MQTT, AMQP and HTTPS support, and IoT Hub throttling, see the [messaging section of the IoT Hub developer guide](iot-hub-devguide-messaging.md).
85-
8683
4. To build the **simulated-device** app using Maven, execute the following command at the command prompt in the simulated-device folder:
8784

8885
```cmd/sh
8986
mvn clean package -DskipTests
9087
```
9188

89+
The `execute` method in the `AppMessageCallback` class returns `IotHubMessageResult.COMPLETE`. This notifies IoT Hub that the message has been successfully processed and that the message can be safely removed from the device queue. The device should this value when its processing successfully completes regardless of the protocol it's using.
90+
91+
With AMQP and HTTPS, but not MQTT, the device can also:
92+
93+
* Abandon a message, which results in IoT Hub retaining the message in the device queue for future consumption.
94+
* Reject a message, which which permanently removes the message from the device queue.
95+
96+
If something happens that prevents the device from completing, abandoning, or rejecting the message, IoT Hub will, after a fixed timeout period, queue the message for delivery again. For this reason, the message processing logic in the device app must be *idempotent*, so that receiving the same message multiple times produces the same result.
97+
98+
For more detailed information about how IoT Hub processes cloud-to-device messages, including details of the cloud-to-device message lifecycle, see [Send cloud-to-device messages from an IoT hub](iot-hub-devguide-messages-c2d.md).
99+
100+
> [!NOTE]
101+
> If you use HTTPS instead of MQTT or AMQP as the transport, the **DeviceClient** instance checks for messages from IoT Hub infrequently (a minimum of every 25 minutes). For more information about the differences between MQTT, AMQP, and HTTPS support, see [Cloud-to-device communications guidance](iot-hub-devguide-c2d-guidance.md) and [Choose a communication protocol](iot-hub/iot-hub-devguide-protocols.md).
102+
92103
## Get the IoT hub connection string
93104

94105
In this article you create a backend service to send cloud-to-device messages through the IoT hub you created in [Send telemetry from a device to an IoT hub](quickstart-send-telemetry-java.md). To send cloud-to-device messages, your service needs the **service connect** permission. By default, every IoT Hub is created with a shared access policy named **service** that grants this permission.

articles/iot-hub/iot-hub-node-node-c2d.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,20 @@ In this section, you modify the simulated device app you created in [Send teleme
6969
});
7070
```
7171

72-
In this example, the device invokes the **complete** function to notify IoT Hub that it has processed the message. The call to **complete** is not required if you are using MQTT transport and can be omitted. It is required for HTTPS and AMQP.
72+
In this example, the device invokes the **complete** function to notify IoT Hub that it has processed the message and that it can safely be removed from the device queue. The call to **complete** is not required if you are using MQTT transport and can be omitted. It is required for AMQP and HTTPS.
73+
74+
With AMQP and HTTPS, but not MQTT, the device can also:
75+
76+
* Abandon a message, which results in IoT Hub retaining the message in the device queue for future consumption.
77+
* Reject a message, which which permanently removes the message from the device queue.
78+
79+
If something happens that prevents the device from completing, abandoning, or rejecting the message, IoT Hub will, after a fixed timeout period, queue the message for delivery again. For this reason, the message processing logic in the device app must be *idempotent*, so that receiving the same message multiple times produces the same result.
80+
81+
For more detailed information about how IoT Hub processes cloud-to-device messages, including details of the cloud-to-device message lifecycle, see [Send cloud-to-device messages from an IoT hub](iot-hub-devguide-messages-c2d.md).
7382

74-
> [!NOTE]
75-
> If you use HTTPS instead of MQTT or AMQP as the transport, the **DeviceClient** instance checks for messages from IoT Hub infrequently (less than every 25 minutes). For more information about the differences between MQTT, AMQP and HTTPS support, and IoT Hub throttling, see the [IoT Hub developer guide](iot-hub-devguide-messaging.md).
76-
>
83+
> [!NOTE]
84+
> If you use HTTPS instead of MQTT or AMQP as the transport, the **DeviceClient** instance checks for messages from IoT Hub infrequently (a minimum of every 25 minutes). For more information about the differences between MQTT, AMQP, and HTTPS support, see [Cloud-to-device communications guidance](iot-hub-devguide-c2d-guidance.md) and [Choose a communication protocol](iot-hub/iot-hub-devguide-protocols.md).
85+
>
7786

7887
## Get the IoT hub connection string
7988

0 commit comments

Comments
 (0)