Skip to content

Commit 72b8260

Browse files
committed
Merge branch 'release-aio-ga' of https://github.com/MicrosoftDocs/azure-docs-pr into patricka-scrub-create-dataflow-release-aio-ga
2 parents 3012325 + a0a7197 commit 72b8260

File tree

6 files changed

+85
-36
lines changed

6 files changed

+85
-36
lines changed

articles/iot-operations/create-edge-apps/concept-about-state-store-protocol.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ ms.topic: concept-article
88
ms.date: 10/30/2024
99

1010
# CustomerIntent: As a developer, I want understand what the MQTT broker state store protocol is, so
11-
# that I can implement a client app to interact with the MQ state store.
11+
# that I can implement a client app to interact with the state store.
1212
ms.service: azure-iot-operations
1313
---
1414

15-
# MQTT broker state store protocol
15+
# State store protocol
1616

17-
The MQ state store is a distributed storage system within the Azure IoT Operations cluster. The state store offers the same high availability guarantees as MQTT messages in MQTT broker. According to the MQTT5/RPC protocol guidelines, clients should use MQTT5 to interact with the MQ state store. This article provides protocol guidance for developers who need to implement their own MQTT broker state store clients.
17+
The state store is a distributed storage system within the Azure IoT Operations cluster. The state store offers the same high availability guarantees as MQTT messages in MQTT broker. According to the MQTT5/RPC protocol guidelines, clients should use MQTT5 to interact with the state store. This article provides protocol guidance for developers who need to implement their own state store clients.
1818

19-
## State store protocol overview
20-
The MQ state store supports the following commands:
19+
## Overview
20+
21+
The state store supports the following commands:
2122

2223
- `SET` \<keyName\> \<keyValue\> \<setOptions\>
2324
- `GET` \<keyName\>
@@ -71,7 +72,7 @@ sequenceDiagram
7172

7273
The commands `SET`, `GET`, and `DEL` behave as expected.
7374

74-
The values that the `SET` command sets, and the `GET` command retrieves, are arbitrary binary data. The size of the values is only limited by the maximum MQTT payload size, and resource limitations of MQ and the client.
75+
The values that the `SET` command sets, and the `GET` command retrieves, are arbitrary binary data. The size of the values is only limited by the maximum MQTT payload size, and resource limitations of MQTT broker and the client.
7576

7677
### `SET` options
7778

@@ -120,7 +121,7 @@ The following example output shows state store RESP3 payloads:
120121
```
121122

122123
> [!NOTE]
123-
> Note that `SET` requires additional MQTT5 properties, as explained in the section [Versioning and hybrid logical clocks](#versioning-and-hybrid-logical-clocks).
124+
> `SET` requires additional MQTT5 properties, as explained in the section [Versioning and hybrid logical clocks](#versioning-and-hybrid-logical-clocks).
124125
125126
### Response format
126127

@@ -421,7 +422,7 @@ The topic is defined in the following example. The `clientId` is an upper-case h
421422
clients/statestore/v1/FA9AE35F-2F64-47CD-9BFF-08E2B32A0FE8/{clientId}/command/notify/{keyName}
422423
```
423424

424-
As an example, MQ publishes a `NOTIFY` message sent to `client-id1` with the modified key name `SOMEKEY` to the topic:
425+
As an example, MQTT broker publishes a `NOTIFY` message sent to `client-id1` with the modified key name `SOMEKEY` to the topic:
425426

426427
```console
427428
clients/statestore/v1/FA9AE35F-2F64-47CD-9BFF-08E2B32A0FE8/636C69656E742D696431/command/notify/534F4D454B4559`

articles/iot-operations/create-edge-apps/edge-apps-overview.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The following sections explain the settings and features that contribute to a ro
2121

2222
## Quality of service (QoS)
2323

24-
Both publishers and subscribers should use [QoS-1](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901236) to guarantee message delivery at least once. The broker stores and retransmits messages until it receives an acknowledgment (ACK) from the recipient, ensuring no messages are lost during transmission.
24+
Both publishers and subscribers should use [QoS-1](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901236) to guarantee message delivery at least once. The MQTT broker stores and retransmits messages until it receives an acknowledgment (ACK) from the recipient, ensuring no messages are lost during transmission.
2525

2626
## Session type and Clean-Session flag
2727

@@ -55,13 +55,13 @@ MQTT subscriptions with QoS-1 ensure eventual consistency across identical appli
5555

5656
[Shared subscriptions](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901250) enable load balancing across multiple instances of a highly available application. Instead of each subscriber receiving a copy of every message, the messages are distributed evenly among the subscribers. MQTT broker currently only supports a round robin algorithm to distribute messages allowing an application to scale out. A typical use case is to deploy multiple pods using Kubernetes ReplicaSet that all subscribe to MQTT broker using the same topic filter in shared subscription.
5757

58-
## Use MQTT broker's built-in key-value store (distributed HashMap)
58+
## State store
5959

60-
MQTT broker's built-in key-value store is a simple, replicated in-memory *HashMap* for managing application processing state. Unlike *etcd*, for example, MQTT broker prioritizes high-velocity throughput, horizontal scaling, and low latency through in-memory data structures, partitioning, and chain-replication. It allows applications to use the broker's distributed nature and fault tolerance while accessing a consistent state quickly across instances. To use the built-in key-value store provided by the distributed broker:
60+
State store is a replicated in-memory *HashMap* for managing application processing state. Unlike *etcd*, for example, state store prioritizes high-velocity throughput, horizontal scaling, and low latency through in-memory data structures, partitioning, and chain-replication. It allows applications to use the state stores distributed nature and fault tolerance while accessing a consistent state quickly across instances. To use the built-in key-value store provided by the distributed broker:
6161

6262
* Implement ephemeral storage and retrieval operations using the broker's key-value store API, ensuring proper error handling and data consistency. Ephemeral state is a short-lived data storage used in stateful processing for fast access to intermediate results or metadata during real-time computations. In the context of HA application, an ephemeral state helps recover application states between crashes. It can be written to disk but remains temporary, as opposed to cold storage that's designed for long-term storage of infrequently accessed data.
6363

64-
* Use the key-value store for sharing state, caching, configuration, or other essential data among multiple instances of the application, allowing them to keep a consistent view of the data.
64+
* Use the state store for sharing state, caching, configuration, or other essential data among multiple instances of the application, allowing them to keep a consistent view of the data.
6565

6666
## Use MQTT broker's built-in Dapr integration
6767

@@ -75,25 +75,15 @@ For simpler use cases an application might utilize [Dapr](https://dapr.io) (Dist
7575

7676
## Checklist to develop a highly available application
7777

78-
- Choose an appropriate MQTT client library for your programming language. The client should support MQTT v5. Use a C or Rust based library if your application is sensitive to latency.
79-
- Configure the client library to connect to MQTT broker with *clean-session* flag set to false and the desired QoS level (QoS-1).
80-
- Decide a suitable value for session expiry, message expiry, and keep-alive intervals.
81-
- Implement the message processing logic for the subscriber application, including sending an acknowledgment when the message has been successfully delivered or processed.
82-
- For multithreaded applications, configure the *max-receive* parameter to enable parallel message processing.
83-
- Utilize retained messages for keeping temporary application state.
84-
- Utilize MQTT broker's built-in key-value store to manage ephemeral application state.
85-
- Evaluate Dapr to develop your application if your use case is simple and doesn't require detailed control over the MQTT connection or message handling.
86-
- Implement shared subscriptions to distribute messages evenly among multiple instances of the application, allowing for efficient scaling.
87-
88-
## Example
89-
90-
The following example implements contextualization and normalization of data with a highly available northbound connector
91-
92-
A northbound application consists of input and output stages, and an optional processing stage. The input stage subscribes to a distributed MQTT broker to receive data, while the output stage ingests messages into a cloud data-lake. The processing stage executes contextualization and normalization logic on the received data.
93-
94-
![Diagram of a highly available app architecture.](./media/edge-apps-overview/highly-available-app.png)
95-
96-
To ensure high availability, the input stage connects to MQTT broker and sets the *clean-session* flag to false for persistent sessions, using QoS-1 for reliable message delivery, acknowledging messages post-processing by the output stage. Additionally, the application might use the built-in *HashMap* key-value store for temporary state management and the round robin algorithm to load-balance multiple instances using shared subscriptions.
78+
* Choose an appropriate MQTT client library for your programming language. The client should support MQTT v5. Use a C or Rust based library if your application is sensitive to latency.
79+
* Configure the client library to connect to MQTT broker with *clean-session* flag set to `false` and the desired QoS level (QoS-1).
80+
* Decide a suitable value for session expiry, message expiry, and keep-alive intervals.
81+
* Implement the message processing logic for the subscriber application, including sending an acknowledgment when the message has been successfully delivered or processed.
82+
* For multithreaded applications, configure the *max-receive* parameter to enable parallel message processing.
83+
* Utilize retained messages for keeping temporary application state.
84+
* Utilize the distributed state store to manage ephemeral application state.
85+
* Evaluate Dapr to develop your application if your use case is simple and doesn't require detailed control over the MQTT connection or message handling.
86+
* Implement shared subscriptions to distribute messages evenly among multiple instances of the application, allowing for efficient scaling.
9787

9888
## Related content
9989

articles/iot-operations/create-edge-apps/howto-deploy-dapr.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To install the Dapr runtime, use the following Helm command:
3131
```bash
3232
helm repo add dapr https://dapr.github.io/helm-charts/
3333
helm repo update
34-
helm upgrade --install dapr dapr/dapr --version=1.13 --namespace dapr-system --create-namespace --wait
34+
helm upgrade --install dapr dapr/dapr --version=1.14 --namespace dapr-system --create-namespace --wait
3535
```
3636

3737
## Register MQTT broker pluggable components
@@ -112,7 +112,7 @@ To create the yaml file, use the following component definitions:
112112
value: /var/run/secrets/tokens/mqtt-client-token
113113
```
114114
115-
1. Apply the component yaml to your cluster by running the following command:
115+
1. Apply the Component to your cluster by running the following command:
116116
117117
```bash
118118
kubectl apply -f components.yaml
@@ -159,7 +159,7 @@ To configure authorization policies to MQTT broker, first you create a [BrokerAu
159159
- "clients/{principal.clientId}/services/statestore/#"
160160
```
161161

162-
1. Apply the BrokerAuthorizaion definition to the cluster:
162+
1. Apply the BrokerAuthorization definition to the cluster:
163163

164164
```bash
165165
kubectl apply -f aio-dapr-authz.yaml
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Persisting data in the MQTT broker state store
3+
description: Understand how to develop application that persist data between sessions using the state store.
4+
author: PatAltimore
5+
ms.subservice: azure-mqtt-broker
6+
ms.author: patricka
7+
ms.topic: concept-article
8+
ms.custom:
9+
- ignite-2023
10+
ms.date: 11/12/2024
11+
12+
#CustomerIntent: As an developer, I want understand how to develop application that persist data between sessions using the state store.
13+
ms.service: azure-iot-operations
14+
---
15+
16+
# Persisting data in the state store
17+
18+
The state store is a distributed storage system, deployed as part of Azure IoT Operations. Using the state store, applications can get, set, and delete key-value pairs, without needing to install more services, such as Redis. The state store also provides versioning of the data, and also the primitives for building distributed locks, ideal for highly available applications.
19+
20+
Like Redis, the state store uses in memory storage. Stopping or restarting the Kubernetes cluster causes the state store contents to be lost.
21+
22+
The state store is implemented via MQTTv5. Its service is integrated directly into MQTT broker and is automatically started when the broker starts. The state store provides the same high availability as the MQTT broker.
23+
24+
## Why use the state store?
25+
26+
The state store allows an edge application to persist data on the edge. Typical uses of the state store include:
27+
28+
* Creating stateless applications
29+
* Sharing state between applications
30+
* Developing highly available applications
31+
* Storing data to be used by dataflows
32+
33+
## State store authorization
34+
35+
The state store extends MQTT broker's authorization mechanism, allowing individual clients to have optional read and write access to specific keys. Read more on how to [configure MQTT broker authorization](../manage-mqtt-broker/howto-configure-authorization.md) for the state store.
36+
37+
## Interacting with the state store
38+
39+
A CLI tool is available which enables interaction with the state store from a shell running on any machine.
40+
41+
1. Generate an X.509 certificate chain for authenticating with MQTT broker
42+
1. Create a `BrokerAuthentication` using x.509 certificates
43+
1. Create a `BrokerListener` of type LoadBalancer which enables off-cluster access
44+
1. Open ports on your cluster to enable access to the MQTT broker.
45+
46+
For instructions on setting up your cluster and using the tool, refer to the [state store CLI GitHub](https://github.com/Azure-Samples/explore-iot-operations/tree/main/tools/state-store-cli) page.
47+
48+
> [!NOTE]
49+
> SDKs to interact with the state store are currently in active development, and will be available in the near future to enable edge applications to interact with the state store.
50+
51+
## Related content
52+
53+
* [Learn about the MQTT broker state store protocol](concept-about-state-store-protocol.md)
54+
* [Configure MQTT broker authorization](../manage-mqtt-broker/howto-configure-authorization.md)

articles/iot-operations/toc.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ items:
149149
items:
150150
- name: Edge apps overview
151151
href: create-edge-apps/edge-apps-overview.md
152+
- name: State store
153+
items:
154+
- name: State store overview
155+
href: create-edge-apps/overview-state-store.md
156+
- name: About the state store protocol
157+
href: create-edge-apps/concept-about-state-store-protocol.md
152158
- name: Dapr apps
153159
items:
154160
- name: Deploy Dapr
@@ -157,8 +163,6 @@ items:
157163
href: create-edge-apps/howto-develop-dapr-apps.md
158164
- name: Build an event-driven app with Dapr
159165
href: create-edge-apps/tutorial-event-driven-with-dapr.md
160-
- name: About the MQ state store protocol
161-
href: create-edge-apps/concept-about-state-store-protocol.md
162166
- name: Develop MQTTnet apps
163167
href: create-edge-apps/howto-develop-mqttnet-apps.md
164168
- name: Tutorials

0 commit comments

Comments
 (0)