Skip to content

Commit 1fbd365

Browse files
committed
Edits
1 parent 5f9d515 commit 1fbd365

4 files changed

+22
-18
lines changed

includes/iot-hub-howto-cloud-to-device-messaging-dotnet.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ There are two options that a device client application can use to receive messag
1717
* **Callback**: The device application sets up an asynchronous message handler method that is called immediately when a message arrives.
1818
* **Polling**: The device application checks for new IoT Hub messages using a code loop (for example, a `while` or `for` loop). The loop executes continually, checking for messages.
1919

20-
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
21-
2220
### Required device NuGet Package
2321

2422
Device client applications written in C# require the **Microsoft.Azure.Devices.Client** NuGet package.
@@ -34,12 +32,10 @@ using Microsoft.Azure.Devices.Shared;
3432

3533
A device app can authenticate with IoT Hub using the following methods:
3634

37-
* X.509 certificate
3835
* Shared access key
36+
* X.509 certificate
3937

40-
#### Authenticate using an X.509 certificate
41-
42-
[!INCLUDE [iot-hub-howto-auth-device-cert-dotnet](iot-hub-howto-auth-device-cert-dotnet.md)]
38+
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
4339

4440
#### Authenticate using a shared access key
4541

@@ -62,6 +58,10 @@ deviceClient = DeviceClient.CreateFromConnectionString(DeviceConnectionString,
6258
TransportType.Mqtt);
6359
```
6460

61+
#### Authenticate using an X.509 certificate
62+
63+
[!INCLUDE [iot-hub-howto-auth-device-cert-dotnet](iot-hub-howto-auth-device-cert-dotnet.md)]
64+
6565
### Callback
6666

6767
To receive callback cloud-to-device messages in the device application, the application must connect to the IoT Hub and set up a callback listener to process incoming messages. Incoming messages to the device are received from the IoT Hub message queue.

includes/iot-hub-howto-cloud-to-device-messaging-java.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ ms.date: 12/19/2024
88
ms.custom: [amqp, mqtt, devx-track-java, devx-track-extended-java]
99
---
1010

11-
## Receive cloud-to-device messages on a device
11+
## Create a device application
1212

1313
This section describes how to receive cloud-to-device messages using the [DeviceClient](/java/api/com.microsoft.azure.sdk.iot.device.deviceclient) class from the Azure IoT SDK for Java.
1414

15-
For a Java-based device application to receive cloud-to-device messages, it must connect to IoT Hub, then set up a callback listener and message handler to process incoming messages from IoT Hub. The device application should also be able to detect and handle disconnects in case the device-to-IoT Hub message connection is broken.
15+
For a Java-based device application to receive cloud-to-device messages, it must connect to IoT Hub, then set up a callback listener and message handler to process incoming messages from IoT Hub.
1616

1717
### Import Azure IoT Java SDK libraries
1818

@@ -31,6 +31,8 @@ A device app can authenticate with IoT Hub using the following methods:
3131
* X.509 certificate
3232
* Shared access key
3333

34+
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
35+
3436
#### Authenticate using an X.509 certificate
3537

3638
[!INCLUDE [iot-hub-howto-auth-device-cert-java](iot-hub-howto-auth-device-cert-java.md)]
@@ -157,7 +159,7 @@ client.open(true);
157159

158160
**HandleMessages**: a sample device app included with the [Microsoft Azure IoT SDK for Java](https://github.com/Azure/azure-iot-sdk-java/tree/main/iothub/device/iot-device-samples), which connects to your IoT hub and receives cloud-to-device messages.
159161

160-
## Send cloud-to-device messages from a backend application
162+
## Create a backend application
161163

162164
This section describes how to send a cloud-to-device message using the [ServiceClient](/java/api/com.azure.core.annotation.serviceclient) class from the Azure IoT SDK for Java. A solution backend application connects to an IoT Hub and messages are sent to IoT Hub encoded with a destination device. IoT Hub stores incoming messages to its message queue, and messages are delivered from the IoT Hub message queue to the target device.
163165

@@ -196,7 +198,7 @@ You can connect a backend service to IoT Hub using the following methods:
196198

197199
#### Connect using a shared access policy
198200

199-
#### Define the connection protocol
201+
##### Define the connection protocol
200202

201203
Use [IotHubServiceClientProtocol](/java/api/com.microsoft.azure.sdk.iot.service.iothubserviceclientprotocol) to define the application-layer protocol used by the service client to communicate with an IoT Hub.
202204

@@ -206,7 +208,7 @@ Use [IotHubServiceClientProtocol](/java/api/com.microsoft.azure.sdk.iot.service.
206208
IotHubServiceClientProtocol protocol = IotHubServiceClientProtocol.AMQPS;
207209
```
208210

209-
#### Create the ServiceClient object
211+
##### Create the ServiceClient object
210212

211213
Create the [ServiceClient](/java/api/com.azure.core.annotation.serviceclient) object, supplying the Iot Hub connection string and protocol.
212214

@@ -215,7 +217,7 @@ String connectionString = "{yourhubconnectionstring}";
215217
ServiceClient serviceClient (connectionString, protocol);
216218
```
217219

218-
### Open the connection between application and IoT Hub
220+
##### Open the connection between application and IoT Hub
219221

220222
[open](/java/api/com.microsoft.azure.sdk.iot.service.serviceclient?#com-microsoft-azure-sdk-iot-service-serviceclient-open()) the AMQP sender connection. This method creates the connection between the application and IoT Hub.
221223

includes/iot-hub-howto-cloud-to-device-messaging-node.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ A device app can authenticate with IoT Hub using the following methods:
2929
* X.509 certificate
3030
* Shared access key
3131

32+
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
33+
3234
#### Authenticate using an X.509 certificate
3335

3436
[!INCLUDE [iot-hub-howto-auth-device-cert-node](iot-hub-howto-auth-device-cert-node.md)]

includes/iot-hub-howto-cloud-to-device-messaging-python.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pip install azure-iot-device
2222

2323
For a Python-based device application to receive cloud-to-device messages, it must connect to IoT Hub and then set up a callback message handler to process incoming messages from IoT Hub.
2424

25-
### Device import statements
25+
### Device import statement
2626

2727
Add this code to import the `IoTHubDeviceClient` functions from the azure.iot.device SDK.
2828

@@ -34,15 +34,11 @@ from azure.iot.device import IoTHubDeviceClient
3434

3535
A device app can authenticate with IoT Hub using the following methods:
3636

37-
* X.509 certificate
3837
* Shared access key
38+
* X.509 certificate
3939

4040
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
4141

42-
#### Authenticate using an X.509 certificate
43-
44-
[!INCLUDE [iot-hub-howto-auth-device-cert-python](iot-hub-howto-auth-device-cert-python.md)]
45-
4642
#### Authenticate using a shared access key
4743

4844
To connect a device to IoT Hub:
@@ -61,6 +57,10 @@ device_client = IoTHubDeviceClient.create_from_connection_string(CONNECTION_STRI
6157
device_client.connect()
6258
```
6359

60+
#### Authenticate using an X.509 certificate
61+
62+
[!INCLUDE [iot-hub-howto-auth-device-cert-python](iot-hub-howto-auth-device-cert-python.md)]
63+
6464
##### Handle reconnection
6565

6666
`IoTHubDeviceClient` will by default attempt to reestablish a dropped connection. Reconnection behavior is governed by the `IoTHubDeviceClient` [connection_retry](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-on-message-received) and `connection_retry_interval` parameters.

0 commit comments

Comments
 (0)