You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-operations/create-edge-apps/howto-develop-mqttnet-apps.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,25 @@
1
1
---
2
-
title: Use MQTTnet to develop distributed application workloads
3
-
description: Develop distributed applications that talk with MQTT broker using MQTTnet.
2
+
title: Develop distributed application workloads with MQTTnet
3
+
description: Learn how to develop distributed applications using MQTTnet to connect with MQTT broker.
4
4
author: PatAltimore
5
5
ms.author: patricka
6
6
ms.subservice: azure-mqtt-broker
7
7
ms.topic: how-to
8
8
ms.custom:
9
9
- ignite-2023
10
-
ms.date: 10/22/2024
10
+
ms.date: 05/07/2025
11
11
12
12
#CustomerIntent: As an developer, I want to understand how to use MQTTnet to develop distributed apps that talk with MQTT broker.
13
13
ms.service: azure-iot-operations
14
14
---
15
15
16
-
# Use MQTTnet to develop distributed application workloads that connect to MQTT broker
16
+
# Develop distributed application workloads with MQTTnet
17
17
18
-
[MQTTnet](https://dotnet.github.io/MQTTnet/) is an open-source, high performance .NET library for MQTT based communication. This article uses a Kubernetes service account token and MQTTnet to connect to MQTT broker. You should use service account tokens to connect in-cluster applications.
18
+
[MQTTnet](https://dotnet.github.io/MQTTnet/) is an open-source, high performance .NET library for MQTT based communication. This article explains how to use a Kubernetes service account token and MQTTnet to connect to MQTT broker. Use service account tokens to connect in-cluster applications.
19
19
20
20
## Sample code
21
21
22
-
The [sample code](https://github.com/Azure-Samples/explore-iot-operations/tree/main/samples/mqtt-client-dotnet/Program.cs)performs the following steps:
22
+
The [sample code](https://github.com/Azure-Samples/explore-iot-operations/tree/main/samples/mqtt-client-dotnet/Program.cs)does the following:
23
23
24
24
1. Creates an MQTT client using the `MqttFactory` class:
25
25
@@ -28,16 +28,16 @@ The [sample code](https://github.com/Azure-Samples/explore-iot-operations/tree/m
28
28
varmqttClient=mqttFactory.CreateMqttClient();
29
29
```
30
30
31
-
1. The [Kubernetespodspecification](#pod-specification) mountstheserviceaccountonthecontainerfilesystem. Thecontentsofthefileareread:
32
-
##3. The mounted token is used as the password with well-known username `K8S-SAT`:
31
+
1. The [Kubernetespodspecification](#pod-specification) mountstheserviceaccountonthecontainerfilesystem, andthefilecontentsareread:
32
+
##3. The mounted token is used as the password with the wellknown username `K8S-SAT`:
1. TheMQTTclientoptionsareconfiguredusingthe `MqttClientOptions` class. Usingthe`MqttClientOptionsBuilder` asadvisedinthe [client](https://github.com/dotnet/MQTTnet/wiki/Client) documentation is the advised way of setting the options:
40
+
1. TheMQTTclientoptionsareconfiguredusingthe `MqttClientOptions` class. The`MqttClientOptionsBuilder`,asrecommendedinthe [client](https://github.com/dotnet/MQTTnet/wiki/Client) documentation, is the preferred way to set the options:
@@ -66,7 +66,7 @@ The [sample code](https://github.com/Azure-Samples/explore-iot-operations/tree/m
66
66
67
67
## Pod specification
68
68
69
-
The `serviceAccountName` fieldinthepodconfigurationmustmatchtheserviceaccountassociatedwiththetokenbeingused. Also, notethe `serviceAccountToken.expirationSeconds` issetto **86400 seconds**, andonceitexpires, youneedtoreloadthetokenfromdisk. Thislogicisn't implemented in this sample.
69
+
The `serviceAccountName` fieldinthepodconfigurationmustmatchtheserviceaccountassociatedwiththetokenbeingused. Also, notethatthe `serviceAccountToken.expirationSeconds` issetto **86400 seconds**, andwhenitexpires, youneedtoreloadthetokenfromdisk. Thislogicisn't implemented in this sample.
70
70
71
71
```yaml
72
72
apiVersion:v1
@@ -86,7 +86,7 @@ spec:
86
86
87
87
volumes:
88
88
89
-
# SAT token used to authenticate between the application and the MQTT broker
89
+
# The SAT token authenticates the application with the MQTT broker
90
90
-name:mqtt-client-token
91
91
projected:
92
92
sources:
@@ -121,7 +121,7 @@ spec:
121
121
value:"/var/run/secrets/tokens/mqtt-client-token"
122
122
```
123
123
124
-
To run the sample, follow the instructions in its [README](https://github.com/Azure-Samples/explore-iot-operations/tree/main/samples/mqtt-client-dotnet).
124
+
Run the sample by following the instructions in its [README](https://github.com/Azure-Samples/explore-iot-operations/tree/main/samples/mqtt-client-dotnet).
0 commit comments