Skip to content

Commit 4dea01f

Browse files
authored
Merge pull request #298457 from DENKEN02MSFT/Top50_baanders_Row46
Top50 - row 46
2 parents d12f9c7 + 0bfe010 commit 4dea01f

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

articles/digital-twins/how-to-create-routes.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ titleSuffix: Azure Digital Twins
44
description: Learn how to set up event routes and event filters to Azure Digital Twins endpoints
55
author: baanders
66
ms.author: baanders
7-
ms.date: 1/3/2024
7+
ms.date: 04/17/2025
88
ms.topic: how-to
99
ms.service: azure-digital-twins
1010
ms.custom: devx-track-azurecli
@@ -18,57 +18,57 @@ Routing [event notifications](concepts-event-notifications.md) from Azure Digita
1818

1919
## Prerequisites
2020

21-
* You'll need an Azure account, which [can be set up for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F)
22-
* You'll need an Azure Digital Twins instance in your Azure subscription. If you don't have an instance already, you can create one using the steps in [Set up an instance and authentication](how-to-set-up-instance-portal.md). Have the following values from setup handy to use later in this article:
21+
* You need an Azure account, which [can be set up for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F)
22+
* You need an Azure Digital Twins instance in your Azure subscription. If you don't have an instance already, you can create one using the steps in [Set up an instance and authentication](how-to-set-up-instance-portal.md). Have the following values from setup handy to use later in this article:
2323
- Instance name
2424
- Resource group
2525

2626
You can find these details in the [Azure portal](https://portal.azure.com) after setting up your instance.
2727

2828
:::image type="content" source="media/includes/instance-details.png" alt-text="Screenshot of the Overview page for an Azure Digital Twins instance in the Azure portal. The name and resource group are highlighted." lightbox="media/includes/instance-details.png":::
2929

30-
* Create an endpoint using the instructions in [Create endpoints](how-to-create-endpoints.md). In this article, you'll create a route to send data to that endpoint.
30+
* Create an endpoint using the instructions in [Create endpoints](how-to-create-endpoints.md). In this article, you create a route to send data to that endpoint.
3131

32-
Next, follow the instructions below if you intend to use the Azure CLI while following this guide.
32+
Next, perform the following instructions if you intend to use the Azure CLI while following this guide.
3333

3434
[!INCLUDE [azure-cli-prepare-your-environment-h3.md](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-h3.md)]
3535

3636
## Create an event route
3737

38-
After [creating an endpoint](how-to-create-endpoints.md), you'll need to define an *event route* to actually send data to the endpoint. These routes let developers wire up event flow, throughout the system and to downstream services. A single route can allow multiple notifications and event types to be selected. Read more about event routes in [Endpoints and event routes](concepts-route-events.md).
38+
After [creating an endpoint](how-to-create-endpoints.md), you'll need to define an *event route* to actually send data to the endpoint. These routes let developers wire up event flow, throughout the system and to downstream services. A single route can allow multiple notifications and event types to be selected. For more information about event routes, see [Route Azure Digital Twins events](concepts-route-events.md).
3939

4040
>[!NOTE]
41-
> Make sure you've created at least one endpoint as described in the [Prerequisites](#prerequisites) before you move on to creating a route.
41+
> Make sure you created at least one endpoint as described in the [Prerequisites](#prerequisites) before you move on to creating a route.
4242
>
43-
>If you've only recently deployed your endpoints, validate that they're finished deploying before attempting to use them for a new event route. If route deployment fails because the endpoints aren't ready, wait a few minutes and try again.
43+
>If you only recently deployed your endpoints, validate that they're finished deploying before attempting to use them for a new event route. If route deployment fails because the endpoints aren't ready, wait a few minutes and try again.
4444
>
45-
> If you are scripting this flow, you may want to account for this by building in 2-3 minutes of wait time for the endpoint service to finish deploying before moving on to route setup.
45+
> If you're scripting this flow, you might want to account for deployment by building in 2-3 minutes of wait time for the endpoint service to finish deploying before moving on to route setup.
4646
4747
A route definition can contain these elements:
4848
* The route name you want to use
4949
* The name of the endpoint you want to use
5050
* A filter that defines which events are sent to the endpoint
5151
- To disable the route so that no events are sent, use a filter value of `false`
5252
- To enable a route that has no specific filtering, use a filter value of `true`
53-
- For details on any other type of filter, see the [Filter events](#filter-events) section below
53+
- For details on any other type of filter, see the [Filter events](#filter-events) section
5454

5555
If there's no route name, no messages are routed outside of Azure Digital Twins.
5656
If there's a route name and the filter is `true`, all messages are routed to the endpoint.
57-
If there's a route name and a different filter is added, messages will be filtered based on the filter.
57+
If there's a route name and a different filter is added, messages are filtered based on the filter.
5858

59-
Event routes can be created with the [Azure portal](https://portal.azure.com), [EventRoutes data plane APIs](/rest/api/digital-twins/dataplane/event-routes), or [az dt route CLI commands](/cli/azure/dt/route). The rest of this section walks through the creation process.
59+
Event routes can be created with the [Azure portal](https://portal.azure.com), [Event Routes data plane APIs](/rest/api/digital-twins/dataplane/event-routes), or [az dt route CLI commands](/cli/azure/dt/route). The rest of this section walks through the creation process.
6060

6161
# [Portal](#tab/portal2)
6262

63-
To create an event route, go to the details page for your Azure Digital Twins instance in the [Azure portal](https://portal.azure.com) (you can find the instance by entering its name into the portal search bar).
63+
To create an event route, go to the details page for your Azure Digital Twins instance in the [Azure portal](https://portal.azure.com). You can find the instance by entering its name into the portal search bar.
6464

6565
From the instance menu, select **Event routes**. Then from the **Event routes** page that follows, select **+ Create an event route**.
6666

6767
On the **Create an event route** page that opens up, choose at minimum:
6868
* A name for your route in the **Name** field
6969
* The **Endpoint** you want to use to create the route
7070

71-
For the route to be enabled, you must also **Add an event route filter** of at least `true`. (Leaving the default value of `false` will create the route, but no events will be sent to it.) To do so, toggle the switch for the **Advanced editor** to enable it, and write `true` in the **Filter** box.
71+
For the route to be enabled, you must also **Add an event route filter** of at least `true`. (Leaving the default value of `false` creates the route, but no events are sent to it.) To do so, toggle the switch for the **Advanced editor** to enable it, and write `true` in the **Filter** box.
7272

7373
:::image type="content" source="media/how-to-create-routes/create-event-route-no-filter.png" alt-text="Screenshot of creating an event route for your instance in the Azure portal." lightbox="media/how-to-create-routes/create-event-route-no-filter.png":::
7474

@@ -93,25 +93,25 @@ This section shows how to create an event route using the [.NET (C#) SDK](/dotne
9393
9494
### Event route sample SDK code
9595

96-
The following sample method shows how to create, list, and delete an event route with the C# SDK:
96+
The following sample method shows how to create, list, and delete an event route with the .NET SDK:
9797

9898
:::code language="csharp" source="~/digital-twins-docs-samples/sdks/csharp/eventRoute_operations.cs" id="FullEventRouteSample":::
9999

100100
---
101101

102102
## Filter events
103103

104-
As described above, routes have a filter field. If the filter value on your route is `false`, no events will be sent to your endpoint.
104+
As described previously, routes have a filter field. If the filter value on your route is `false`, no events are sent to your endpoint.
105105

106-
After you've enabled a minimal filter of `true`, endpoints will receive different kinds of events from Azure Digital Twins:
106+
After you enabled a minimal filter of `true`, endpoints will receive different kinds of events from Azure Digital Twins:
107107
* [Telemetry fired by digital twins](concepts-event-notifications.md#digital-twin-telemetry-messages) using the Azure Digital Twins service API
108108
* Twin property change notifications, fired on property changes for any twin in the Azure Digital Twins instance
109109
* Life-cycle events, fired when twins or relationships are created or deleted
110110

111111
You can restrict the types of events being sent by defining a more-specific filter.
112112

113113
>[!NOTE]
114-
> Filters are case-sensitive and need to match the payload case. For telemetry filters, this means that the casing needs to match the casing in the telemetry sent by the device.
114+
> Filters are case-sensitive and need to match the payload case. For telemetry filters, the casing in the filter must match the casing in the telemetry sent by the device.
115115
116116
# [Portal](#tab/portal3)
117117

@@ -125,7 +125,7 @@ To use the basic filters, expand the **Event types** option and select the check
125125

126126
:::image type="content" source="media/how-to-create-routes/create-event-route-filter-basic-1.png" alt-text="Screenshot of creating an event route with a basic filter in the Azure portal, highlighting the checkboxes of the events." lightbox="media/how-to-create-routes/create-event-route-filter-basic-1-large.png":::
127127

128-
Doing so will autopopulate the filter text box with the text of the filter you've selected:
128+
Doing so autopopulates the filter text box with the text of the filter you selected:
129129

130130
:::image type="content" source="media/how-to-create-routes/create-event-route-filter-basic-2.png" alt-text="Screenshot of creating an event route with a basic filter in the Azure portal, highlighting the autopopulated filter text after selecting the events." lightbox="media/how-to-create-routes/create-event-route-filter-basic-2-large.png":::
131131

@@ -154,16 +154,16 @@ Here are the supported route filters.
154154
| True / False | Allows creating a route with no filtering, or disabling a route so no events are sent | `<true/false>` | `true` = route is enabled with no filtering <br> `false` = route is disabled |
155155
| Type | The [type of event](concepts-route-events.md#types-of-event-messages) flowing through your digital twin instance | `type = '<event-type>'` | Here are the possible event type values: <br>`Microsoft.DigitalTwins.Twin.Create` <br> `Microsoft.DigitalTwins.Twin.Delete` <br> `Microsoft.DigitalTwins.Twin.Update`<br>`Microsoft.DigitalTwins.Relationship.Create`<br>`Microsoft.DigitalTwins.Relationship.Update`<br> `Microsoft.DigitalTwins.Relationship.Delete` <br> `microsoft.iot.telemetry` |
156156
| Source | Name of Azure Digital Twins instance | `source = '<host-name>'`| Here are the possible host name values: <br><br> For notifications: `<your-Digital-Twins-instance>.api.<your-region>.digitaltwins.azure.net` <br><br> For telemetry: `<your-Digital-Twins-instance>.api.<your-region>.digitaltwins.azure.net/<twin-ID>`|
157-
| Subject | A description of the event in the context of the event source above | `subject = '<subject>'` | Here are the possible subject values: <br><br>For notifications: The subject is `<twin-ID>` <br> or a URI format for subjects, which are uniquely identified by multiple parts or IDs:<br>`<twin-ID>/relationships/<relationship-ID>`<br><br> For telemetry: The subject is the component path (if the telemetry is emitted from a twin component), such as `comp1.comp2`. If the telemetry isn't emitted from a component, then its subject field is empty. |
157+
| Subject | A description of the event in the context of the event source | `subject = '<subject>'` | Here are the possible subject values: <br><br>For notifications: The subject is `<twin-ID>` <br> or a URI format for subjects, which are uniquely identified by multiple parts or IDs:<br>`<twin-ID>/relationships/<relationship-ID>`<br><br> For telemetry: The subject is the component path (if the telemetry is emitted from a twin component), such as `comp1.comp2`. If the telemetry isn't emitted from a component, then its subject field is empty. |
158158
| Data schema | DTDL model ID | `dataschema = '<model-dtmi-ID>'` | For telemetry: The data schema is the model ID of the twin or the component that emits the telemetry. For example, `dtmi:example:com:floor4;2` <br><br>For notifications (create/delete): Data schema can be accessed in the notification body at `$body.$metadata.$model`. <br><br>For notifications (update): Data schema can be accessed in the notification body at `$body.modelId`|
159159
| Content type | Content type of data value | `datacontenttype = '<content-type>'` | The content type is `application/json` |
160160
| Spec version | The version of the event schema you're using | `specversion = '<version>'` | The version must be `1.0`. This value indicates the CloudEvents schema version 1.0 |
161161
| Notification body | Reference any property in the `data` field of a notification | `$body.<property>` | See [Event notifications](concepts-event-notifications.md) for examples of notifications. Any property in the `data` field can be referenced using `$body` |
162162

163163
>[!NOTE]
164-
> Azure Digital Twins currently doesn't support filtering events based on fields within an array. This includes filtering on properties within a `patch` section of a [digital twin change notification](concepts-event-notifications.md#digital-twin-change-notifications).
164+
> Azure Digital Twins currently doesn't support filtering events based on fields within an array. This limitation includes filtering on properties within a `patch` section of a [digital twin change notification](concepts-event-notifications.md#digital-twin-change-notifications).
165165
166-
The following data types are supported as values returned by references to the data above:
166+
The following data types are supported as values returned by references to the previous data:
167167

168168
| Data type | Example |
169169
|-|-|-|
@@ -188,13 +188,13 @@ The following functions are supported when defining route filters:
188188
|ENDS_WITH(x,y) | Returns true if the value `x` ends with the string `y`.|`ENDS_WITH($body.$metadata.$model, 'floor;1')`|
189189
|CONTAINS(x,y)| Returns true if the value `x` contains the string `y`.|`CONTAINS(subject, '<twin-ID>')`|
190190

191-
When you implement or update a filter, the change may take a few minutes to be reflected in the data pipeline.
191+
When you implement or update a filter, the change might take a few minutes to be reflected in the data pipeline.
192192

193193
## Monitor event routes
194194

195195
Routing metrics such as count, latency, and failure rate can be viewed in the [Azure portal](https://portal.azure.com/).
196196

197-
For information about viewing and managing metrics with Azure Monitor, see [Get started with metrics explorer](/azure/azure-monitor/essentials/metrics-getting-started). For a full list of routing metrics available for Azure Digital Twins, see [Azure Digital Twins routing metrics](how-to-monitor.md#routing-metrics).
197+
For information about viewing and managing metrics with Azure Monitor, see [Analyze metrics with Azure Monitor metrics explorer](/azure/azure-monitor/essentials/metrics-getting-started). For a full list of routing metrics available for Azure Digital Twins, see [Routing metrics](how-to-monitor.md#routing-metrics).
198198

199199
## Next steps
200200

-40.6 KB
Loading
-53.8 KB
Loading

0 commit comments

Comments
 (0)