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/connect-to-cloud/howto-create-dataflow.md
+74-1Lines changed: 74 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1291,7 +1291,7 @@ Similar to data sources, data destination is a concept that is used to keep the
1291
1291
1292
1292
| Endpoint type | Data destination meaning | Description |
1293
1293
| - | - | - |
1294
-
| MQTT (or Event Grid) | Topic | The MQTT topic where the data is sent. Only static topics are supported, no wildcards. |
1294
+
| MQTT (or Event Grid) | Topic | The MQTT topic where the data is sent. Supports both static topics and dynamic topic translation using variables like `${inputTopic}` and `${inputTopic.index}`. For more information, see [Dynamic destination topics](#dynamic-destination-topics). |
1295
1295
| Kafka (or Event Hubs) | Topic | The Kafka topic where the data is sent. Only static topics are supported, no wildcards. If the endpoint is an Event Hubs namespace, the data destination is the individual event hub within the namespace. |
1296
1296
| Azure Data Lake Storage | Container | The container in the storage account. Not the table. |
1297
1297
| Microsoft Fabric OneLake | Table or Folder | Corresponds to the configured [path type for the endpoint](howto-configure-fabric-endpoint.md#onelake-path-type). |
@@ -1337,6 +1337,18 @@ Or, if you have custom event hub endpoint, the configuration would look like:
1337
1337
}
1338
1338
}
1339
1339
```
1340
+
1341
+
For MQTT endpoints, you can also use dynamic topic variables. For example, to route messages from `factory/1/data` to `processed/factory/1`:
For MQTT endpoints, you can use dynamic topic variables in the `dataDestination` field to route messages based on the source topic structure. The following variables are available:
1446
+
1447
+
- `${inputTopic}`- The full original input topic
1448
+
- `${inputTopic.index}`- A segment of the input topic (index starts at 1)
1449
+
1450
+
For example, `processed/factory/${inputTopic.2}` routes messages from `factory/1/data` to `processed/factory/1`. Topic segments are 1-indexed, and leading/trailing slashes are ignored.
1451
+
1452
+
If a topic variable cannot be resolved (for example, `${inputTopic.5}` when the input topic only has 3 segments), the message is dropped and a warning is logged. Wildcard characters (`#` and `+`) are not allowed in destination topics.
1453
+
1454
+
> [!NOTE]
1455
+
> The characters `$`, `{`, and `}` are valid in MQTT topic names, so a topic like `factory/$inputTopic.2` is acceptable but incorrect if you intended to use the dynamic topic variable.
1456
+
1414
1457
## Example
1415
1458
1416
1459
The following example is a data flow configuration that uses the MQTT endpoint for the source and destination. The source filters the data from the MQTT topic `azure-iot-operations/data/thermostat`. The transformation converts the temperature to Fahrenheit and filters the data where the temperature multiplied by the humidity is less than 100000. The destination sends the data to the MQTT topic `factory`.
@@ -1504,6 +1547,35 @@ Here's an example command to create or update a data flow using the default data
This configuration processes messages from `thermostats/device1/sensor/temperature` and sends them to `processed/device/device1/temperature`.
1578
+
1507
1579
# [Bicep](#tab/bicep)
1508
1580
1509
1581
```bicep
@@ -1714,6 +1786,7 @@ To ensure the data flow is working as expected, verify the following:
1714
1786
- When using Event Hubs as the source, each event hub in the namespace is a separate Kafka topic and must be specified as the data source.
1715
1787
- Transformation, if used, is configured with proper syntax, including proper [escaping of special characters](./concept-dataflow-mapping.md#escaping).
1716
1788
- When using storage type endpoints as destination, a [schema is specified](#serialize-data-according-to-a-schema).
1789
+
- When using dynamic destination topics for MQTT endpoints, ensure that topic variables reference valid segments.
0 commit comments