Skip to content

Commit 245d932

Browse files
Merge pull request #299500 from PatAltimore/patricka-aio-freshness
Update freshness
2 parents 0c53fb5 + 09319da commit 245d932

File tree

2 files changed

+41
-40
lines changed

2 files changed

+41
-40
lines changed

articles/iot-operations/create-edge-apps/howto-develop-mqttnet-apps.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
---
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.
44
author: PatAltimore
55
ms.author: patricka
66
ms.subservice: azure-mqtt-broker
77
ms.topic: how-to
88
ms.custom:
99
- ignite-2023
10-
ms.date: 10/22/2024
10+
ms.date: 05/07/2025
1111

1212
#CustomerIntent: As an developer, I want to understand how to use MQTTnet to develop distributed apps that talk with MQTT broker.
1313
ms.service: azure-iot-operations
1414
---
1515

16-
# Use MQTTnet to develop distributed application workloads that connect to MQTT broker
16+
# Develop distributed application workloads with MQTTnet
1717

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.
1919

2020
## Sample code
2121

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:
2323

2424
1. Creates an MQTT client using the `MqttFactory` class:
2525

@@ -28,16 +28,15 @@ The [sample code](https://github.com/Azure-Samples/explore-iot-operations/tree/m
2828
var mqttClient = mqttFactory.CreateMqttClient();
2929
```
3030

31-
1. The [Kubernetes pod specification](#pod-specification) mounts the service account on the container file system. The contents of the file are read:
32-
##3. The mounted token is used as the password with well-known username `K8S-SAT`:
31+
1. The [Kubernetes pod specification](#pod-specification) mounts the service account on the container file system, and the file contents are read. The mounted token is used as the password with the well known username `K8S-SAT`:
3332

3433
```csharp
3534
static string sat_auth_file = "/var/run/secrets/tokens/mqtt-client-token";
3635
...
3736
var satToken = File.ReadAllBytes(sat_auth_file);
3837
```
3938

40-
1. The MQTT client options are configured using the `MqttClientOptions` class. Using the `MqttClientOptionsBuilder` as advised in the [client](https://github.com/dotnet/MQTTnet/wiki/Client) documentation is the advised way of setting the options:
39+
1. The MQTT client options are configured using the `MqttClientOptions` class. The `MqttClientOptionsBuilder`, as recommended in the [client](https://github.com/dotnet/MQTTnet/wiki/Client) documentation, is the preferred way to set the options:
4140
4241
```csharp
4342
var mqttClientOptions = new MqttClientOptionsBuilder()
@@ -53,7 +52,7 @@ The [sample code](https://github.com/Azure-Samples/explore-iot-operations/tree/m
5352
var response = await mqttClient.ConnectAsync(mqttClientOptions.Build(), CancellationToken.None);
5453
```
5554

56-
6. MQTT messages can be created using the properties directly or using `MqttApplicationMessageBuilder`. This class has overloads that allow dealing with different payload formats. The API of the builder is a fluent API. The following code shows how to compose an application message and publish them to an article called *sampletopic*:
55+
1. Create MQTT messages using properties directly or with `MqttApplicationMessageBuilder`. This class provides overloads for handling different payload formats. The builder API uses a fluent design. The following code shows how to compose an application message and publish it to a topic called *sampletopic*:
5756

5857
```csharp
5958
var applicationMessage = new MqttApplicationMessageBuilder()
@@ -66,7 +65,7 @@ The [sample code](https://github.com/Azure-Samples/explore-iot-operations/tree/m
6665

6766
## Pod specification
6867

69-
The `serviceAccountName` field in the pod configuration must match the service account associated with the token being used. Also, note the `serviceAccountToken.expirationSeconds` is set to **86400 seconds**, and once it expires, you need to reload the token from disk. This logic isn't implemented in this sample.
68+
The `serviceAccountName` field in the pod configuration must match the service account associated with the token being used. Also, note that the `serviceAccountToken.expirationSeconds` is set to **86400 seconds**, and when it expires, you need to reload the token from disk. This logic isn't implemented in this sample.
7069

7170
```yaml
7271
apiVersion: v1
@@ -86,7 +85,7 @@ spec:
8685

8786
volumes:
8887

89-
# SAT token used to authenticate between the application and the MQTT broker
88+
# The SAT token authenticates the application with the MQTT broker
9089
- name: mqtt-client-token
9190
projected:
9291
sources:
@@ -121,7 +120,7 @@ spec:
121120
value: "/var/run/secrets/tokens/mqtt-client-token"
122121
```
123122

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).
123+
Run the sample by following the instructions in its [README](https://github.com/Azure-Samples/explore-iot-operations/tree/main/samples/mqtt-client-dotnet).
125124

126125
## Related content
127126

articles/iot-operations/manage-mqtt-broker/overview-broker.md

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
---
2-
title: Publish and subscribe MQTT messages using MQTT broker
2+
title: Publish and Subscribe MQTT Messages Using Azure MQTT Broker
33
description: Use MQTT broker to publish and subscribe to messages. Destinations include other MQTT brokers, data flows, and Azure cloud services.
4+
#customer intent: As a solution architect, I want to learn about the architecture of the Azure MQTT Broker so that I can design fault-tolerant and scalable IoT solutions.
45
author: PatAltimore
56
ms.author: patricka
67
ms.subservice: azure-mqtt-broker
78
ms.topic: conceptual
89
ms.custom:
910
- ignite-2023
10-
ms.date: 11/04/2024
11-
12-
#CustomerIntent: As an operator, I want to understand how I can use MQTT broker to publish and subscribe to MQTT topics.
11+
- ai-gen-docs-bap
12+
- ai-gen-title
13+
- ai-seo-date:05/07/2025
14+
ms.date: 05/07/2025
1315
ms.service: azure-iot-operations
1416
---
1517

1618
# Azure IoT Operations built-in local MQTT broker
1719

1820
[!INCLUDE [kubernetes-management-preview-note](../includes/kubernetes-management-preview-note.md)]
1921

20-
Azure IoT Operations features an MQTT broker that's enterprise grade and compliant with standards. The MQTT broker is scalable, highly available, and Kubernetes-native. It provides the messaging plane for IoT Operations, enables bidirectional edge/cloud communication, and powers [event-driven applications](/azure/architecture/guide/architecture-styles/event-driven) at the edge.
22+
Azure IoT Operations includes an MQTT broker that's enterprise grade and standards compliant. The MQTT broker is scalable, highly available, and Kubernetes native. It provides the messaging plane for IoT Operations, enables bidirectional edge-to-cloud communication, and supports [event-driven applications](/azure/architecture/guide/architecture-styles/event-driven) at the edge.
2123

2224
## MQTT compliance
2325

24-
MQTT has emerged as the common language that's used among protocols in the IoT space. MQTT's simple design allows a single broker to serve tens of thousands of clients simultaneously, with lightweight publish-subscribe topic creation and management. Many IoT devices support MQTT natively out of the box. Downstream translation gateways rationalize the long tail of IoT protocols into MQTT.
26+
MQTT is a common protocol in the IoT space. Its simple design lets a single broker serve thousands of clients simultaneously with lightweight publish-subscribe topic creation and management. Many IoT devices natively support MQTT. Downstream translation gateways convert various IoT protocols into MQTT.
2527

26-
The MQTT broker underpins the messaging layer in IoT Operations and supports both MQTT v3.1.1 and MQTT v5. For more information about supported MQTT features, see [MQTT feature support in MQTT broker](../reference/mqtt-support.md).
28+
The MQTT broker supports the messaging layer in IoT Operations and is compatible with MQTT v3.1.1 and MQTT v5. For more information about supported MQTT features, see [MQTT feature support in MQTT broker](../reference/mqtt-support.md).
2729

2830
## Architecture
2931

@@ -32,26 +34,26 @@ The MQTT broker has two major layers:
3234
- Stateless frontend layer
3335
- Stateful and sharded backend layer
3436

35-
The frontend layer handles client connections and requests and routes them to the backend. The backend layer partitions data by different keys, such as a client ID for client sessions and a topic name for topic messages. It uses chain replication to replicate data within each partition.
37+
The frontend layer handles client connections and requests, and it routes them to the backend. The backend layer partitions data by keys, like a client ID for client sessions and a topic name for topic messages. The backend layer uses chain replication to copy data within each partition.
3638

3739
The goals of the architecture are:
3840

39-
- **Fault tolerance and isolation**: Message publishing continues if backend pods fail and prevents failures from propagating to the rest of the system.
41+
- **Fault tolerance and isolation**: Message publishing continues if backend pods fail, and failures don't propagate to the rest of the system.
4042
- **Failure recovery**: Automatic failure recovery without operator intervention.
41-
- **No message loss**: Delivery of messages if at least one frontend pod and one backend pod in a partition is running.
42-
- **Elastic scaling**: Horizontal scaling of publishing and subscribing throughput to support edge and cloud deployments.
43-
- **Consistent performance at scale**: Limit message latency overhead because of chain replication.
44-
- **Operational simplicity**: Minimum dependency on external components to simplify maintenance and complexity.
43+
- **No message loss**: Messages are delivered if at least one frontend pod and one backend pod in a partition are running.
44+
- **Elastic scaling**: Horizontal scaling of publishing and subscribing throughput supports edge and cloud deployments.
45+
- **Consistent performance at scale**: Limits message latency overhead due to chain replication.
46+
- **Operational simplicity**: Reduces dependency on external components to simplify maintenance and complexity.
4547

4648
## Configuration
4749

48-
For configuration, the MQTT broker is composed of several Kubernetes custom resources that define different aspects of the broker's behavior and functionality:
50+
For configuration, the MQTT broker uses several Kubernetes custom resources to define different aspects of the broker's behavior and functionality:
4951

5052
- The main resource is [Broker](/rest/api/iotoperations/broker), which defines the global settings like cardinality, memory usage profile, and diagnostic settings.
5153
- A Broker resource can have up to three [BrokerListeners](/rest/api/iotoperations/broker-listener), each of which listens for incoming MQTT connections on the specified service type (`NodePort`, `LoadBalancer`, or `ClusterIP`). Each BrokerListener resource can have multiple ports.
5254
- Each port within a BrokerListener resource can be associated with a [BrokerAuthentication](/rest/api/iotoperations/broker-authentication) resource and a [BrokerAuthorization](/rest/api/iotoperations/broker-authorization) resource. These authentication and authorization policies determine which clients can connect to the port and what actions they can perform on the broker.
5355

54-
The relationship between Broker and BrokerListener is *one-to-many*. The relationship between BrokerListener and BrokerAuthentication/BrokerAuthorization is *many-to-many*. The entity relationship diagram for these resources is:
56+
The relationship between Broker and BrokerListener is *one-to-many*, while the relationship between BrokerListener and BrokerAuthentication/BrokerAuthorization is *many-to-many*. The entity relationship diagram for these resources is:
5557

5658
<!-- ```mermaid
5759
erDiagram
@@ -89,11 +91,11 @@ erDiagram
8991
:::image type="content" source="media/overview-broker/default-broker-resources.svg" alt-text="Diagram that shows the default broker resources and relationships between them.":::
9092

9193
> [!IMPORTANT]
92-
> To prevent unintentional disruption with communication between IoT Operations internal components, we recommend that you don't modify any default configuration.
94+
> To avoid disrupting communication between IoT Operations internal components, don't modify any default configuration.
9395
>
94-
> To customize the MQTT broker deployment, *add* new resources like BrokerListeners, BrokerAuthentication, and BrokerAuthorization to the default Broker.
96+
> To customize the MQTT broker deployment, add new resources such as BrokerListeners, BrokerAuthentication, and BrokerAuthorization to the default Broker.
9597
>
96-
> The Broker resource itself is immutable and can't be modified after deployment, but it only needs customization in advanced scenarios. To learn more about customizing the Broker resource, see [Customize default Broker](#customize-default-broker).
98+
> The Broker resource is immutable and can't be modified after deployment, but it requires customization only in advanced scenarios. To learn more about customizing the Broker resource, see [Customize default Broker](#customize-default-broker).
9799
98100
In a full deployment, you could have multiple BrokerListeners, each with multiple ports, and each port could have different BrokerAuthentication and BrokerAuthorization resources associated with it.
99101

@@ -104,7 +106,7 @@ For example, starting from the default setup, you add:
104106
- A BrokerAuthentication resource named *example-authn*, with a custom authentication method.
105107
- A BrokerAuthorization resource named *example-authz*, with your custom authorization settings.
106108

107-
Then, if you configure all the new ports by using the same BrokerAuthentication and BrokerAuthorization resources, the setup looks like:
109+
If you configure all the new ports with the same BrokerAuthentication and BrokerAuthorization resources, the setup looks like this:
108110

109111
<!-- ```mermaid
110112
erDiagram
@@ -165,18 +167,18 @@ erDiagram
165167

166168
:::image type="content" source="media/overview-broker/full-broker-deployment-resources.svg" alt-text="Diagram that shows a full custom broker deployment and relationships between each.":::
167169

168-
This way, you keep the default setup intact and add new resources to customize the MQTT broker deployment to your needs.
170+
This approach keeps the default setup intact and lets you add new resources to customize the MQTT broker deployment.
169171

170172
## Default Broker resource
171173

172-
Each IoT Operations deployment can have only one Broker, and it must be named *default*. The default Broker resource is required for IoT Operations to function. It's immutable and can't be modified after deployment.
174+
Each IoT Operations deployment can have only one broker, and it must be named *default*. The default broker resource is required for IoT Operations to function. It's immutable and can't be modified after deployment.
173175

174176
> [!CAUTION]
175-
> Don't delete the default Broker resource. Doing so disrupts communication between IoT Operations internal components, and the deployment stops functioning.
177+
> Don't delete the default broker resource. Doing so disrupts communication between IoT Operations internal components, and the deployment stops functioning.
176178
177179
### Customize default Broker
178180

179-
Customizing the default Broker resource isn't required for most setups. The settings that require customization include:
181+
Customizing the default broker resource isn't required for most setups. The settings that require customization include:
180182

181183
- [Cardinality](./howto-configure-availability-scale.md#configure-scaling-settings): Determines the broker's capacity to handle more connections and messages, and it enhances high availability if there are pod or node failures.
182184
- [Memory profile](./howto-configure-availability-scale.md#configure-memory-profile): Sets the maximum memory usage of the broker and how to handle memory usage as the broker scales up.
@@ -185,7 +187,7 @@ Customizing the default Broker resource isn't required for most setups. The sett
185187
- [Advanced MQTT client options](./howto-broker-mqtt-client-options.md): Configuration for advanced MQTT client options like session expiry, message expiry, and keep-alive settings.
186188
- [Encryption of internal traffic](./howto-encrypt-internal-traffic.md): Configuration for encrypting internal traffic between broker frontend and backend pods.
187189

188-
You can customize the default broker only during initial deployment time, by using the Azure CLI or the Azure portal. A new deployment is required if you need different Broker configuration settings.
190+
You can customize the default broker only during the initial deployment, by using the Azure CLI or the Azure portal. A new deployment is required if you need different broker configuration settings.
189191

190192
To customize the default Broker during deployment:
191193

@@ -195,7 +197,7 @@ When you follow the guide to [deploy IoT Operations](../deploy-iot-ops/howto-dep
195197

196198
# [Azure CLI](#tab/azure-cli)
197199

198-
To configure settings like disk-backed message buffer and advanced MQTT client options, use the `--broker-config-file` flag during `az iot ops create`. To learn more, see [Azure CLI support for advanced MQTT broker configuration](https://aka.ms/aziotops-broker-config).
200+
To configure settings like the disk-backed message buffer and advanced MQTT client options, use the `--broker-config-file` flag during `az iot ops create`. To learn more, see [Azure CLI support for advanced MQTT broker configuration](https://aka.ms/aziotops-broker-config).
199201

200202
# [Bicep](#tab/bicep)
201203

@@ -208,13 +210,13 @@ Use the Azure portal or the Azure CLI to customize the default Broker resource.
208210
---
209211

210212
> [!IMPORTANT]
211-
> You can't update the broker resource after the initial deployment. Configuration changes to cardinality, memory profile, or disk buffer aren't allowed post-deployment.
213+
> You can't update the broker resource after the initial deployment. Configuration changes to cardinality, memory profile, or the disk buffer aren't allowed post-deployment.
212214
>
213215
> As a workaround, when deploying Azure IoT Operations with the [az iot ops init](/cli/azure/iot/ops#az-iot-ops-init) command, you can include the `--broker-config-file` parameter with a JSON configuration file for the MQTT broker. For more information, see [Advanced MQTT broker config](https://github.com/Azure/azure-iot-ops-cli-extension/wiki/Advanced-Mqtt-Broker-Config) and [Configure core MQTT broker settings](../manage-mqtt-broker/howto-configure-availability-scale.md).
214216
215217
### View default Broker settings
216218

217-
To view the settings for the default Broker:
219+
To view the settings for the default broker:
218220

219221
# [Portal](#tab/portal)
220222

0 commit comments

Comments
 (0)