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/event-grid/handler-service-bus.md
+73-37Lines changed: 73 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,26 +2,26 @@
2
2
title: Service Bus queues and topics as event handlers for Azure Event Grid events
3
3
description: Describes how you can use Service Bus queues and topics as event handlers for Azure Event Grid events.
4
4
ms.topic: conceptual
5
-
ms.date: 09/30/2021
5
+
ms.date: 11/17/2022
6
6
---
7
7
8
8
# Service Bus queues and topics as event handlers for Azure Event Grid events
9
-
An event handler is the place where the event is sent. The handler takes some further action to process the event. Several Azure services are automatically configured to handle events and **Azure Service Bus** is one of them.
10
-
11
-
You can use a Service queue or topic as a handler for events from Event Grid.
9
+
An event handler receives events from an event source via Event Grid, and processes those events. You can use instances of a few Azure services to handle events and **Azure Service Bus** is one of them. This article shows you how to use a Service Bus queue or topic as a handler for events from Event Grid.
12
10
13
11
## Service Bus queues
14
12
15
-
> [!NOTE]
16
-
> Session enabled queues are not supported as event handlers for Azure Event Grid events
17
-
18
-
You can route events in Event Grid directly to Service Bus queues for use in buffering or command & control scenarios in enterprise applications.
13
+
You can route events in Event Grid directly to Service Bus queues for use in buffering or command and control scenarios in enterprise applications.
19
14
20
-
In the Azure portal, while creating an event subscription, select **Service Bus Queue** as endpoint type and then click **select an endpoint** to choose a Service Bus queue.
15
+
### Use Azure portal
16
+
In the Azure portal, while creating an event subscription, select **Service Bus Queue** as the endpoint type and then click **select an endpoint** to choose a Service Bus queue.
21
17
22
-
### Using CLI to add a Service Bus queue handler
18
+
:::image type="content" source="./media/handler-service-bus/queue.png" lightbox="./media/handler-service-bus/queue.png" alt-text="Screenshot showing the configuration of a Service Bus queue handler.":::
23
19
24
-
For Azure CLI, the following example subscribes and connects an event grid topic to a Service Bus queue:
20
+
> [!NOTE]
21
+
> Session enabled queues are not supported as event handlers for Azure Event Grid events
22
+
23
+
### Use Azure CLI
24
+
Use the [`az eventgrid event-subscription create`](/cli/azure/eventgrid/event-subscription) command with `--endpoint-type` set to `servicebusqueue` and `--endpoint` set to `/subscriptions/{AZURE SUBSCRIPTION}/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.ServiceBus/namespaces/<NAMESPACE NAME>/queues/<QUEUE NAME>`. Here's an example:
25
25
26
26
```azurecli-interactive
27
27
az eventgrid event-subscription create \
@@ -31,15 +31,33 @@ az eventgrid event-subscription create \
You can also use the [`az eventgrid topic event-subscription`](/cli/azure/eventgrid/topic/event-subscription) command for custom topics, the [`az eventgrid system-topic event-subscription`](/cli/azure/eventgrid/system-topic/event-subscription) command for system topics, and the [`az eventgrid partner topic event-subscription create`](/cli/azure/eventgrid/partner/topic/event-subscription#az-eventgrid-partner-topic-event-subscription-create) command for partner topics.
35
+
36
+
### Use Azure PowerShell
37
+
Use the [New-AzEventGridSubscription](/powershell/module/az.eventgrid/new-azeventgridsubscription) command with `-EndpointType` set to `servicebusqueue` and `-Endpoint` set to `/subscriptions/{AZURE SUBSCRIPTION}/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.ServiceBus/namespaces/<NAMESPACE NAME>/queues/<QUEUE NAME>`. Here's an example:
You can also use the [`New-AzEventGridSystemTopicEventSubscription`](/powershell/module/az.eventgrid/new-azeventgridsystemtopiceventsubscription) command for system topics, and the [`New-AzEventGridPartnerTopicEventSubscription`](/powershell/module/az.eventgrid/new-azeventgridpartnertopiceventsubscription) command for partner topics.
49
+
34
50
## Service Bus topics
35
51
36
-
You can route events in Event Grid directly to Service Bus topics to handle Azure system events with Service Bus topics, or for command & control messaging scenarios.
52
+
You can route events in Event Grid directly to Service Bus topics for command and control messaging scenarios.
37
53
38
-
In the Azure portal, while creating an event subscription, select **Service Bus Topic** as endpoint type and then click **select and endpoint** to choose a Service Bus topic.
54
+
### Use Azure portal
55
+
In the Azure portal, while creating an event subscription, select **Service Bus Topic** as the endpoint type and then click **select an endpoint** to choose a Service Bus topic.
39
56
40
-
### Using CLI to add a Service Bus topic handler
57
+
:::image type="content" source="./media/handler-service-bus/topic.png" lightbox="./media/handler-service-bus/topic.png" alt-text="Screenshot showing the configuration of a Service Bus topic handler.":::
41
58
42
-
For Azure CLI, the following example subscribes and connects an event grid topic to a Service Bus topic:
59
+
### Use Azure CLI
60
+
Use the [`az eventgrid event-subscription create`](/cli/azure/eventgrid/event-subscription) command with `--endpoint-type` set to `servicebustopic` and `--endpoint` set to `/subscriptions/{AZURE SUBSCRIPTION}/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.ServiceBus/namespaces/<NAMESPACE NAME>/topics/<TOPIC NAME>`. Here's an example:
43
61
44
62
```azurecli-interactive
45
63
az eventgrid event-subscription create \
@@ -49,12 +67,52 @@ az eventgrid event-subscription create \
You can also use the [`az eventgrid topic event-subscription`](/cli/azure/eventgrid/topic/event-subscription) command for custom topics, the [`az eventgrid system-topic event-subscription`](/cli/azure/eventgrid/system-topic/event-subscription) command for system topics, and the [`az eventgrid partner topic event-subscription create`](/cli/azure/eventgrid/partner/topic/event-subscription#az-eventgrid-partner-topic-event-subscription-create) command for partner topics.
71
+
72
+
### Use Azure PowerShell
73
+
Use the [New-AzEventGridSubscription](/powershell/module/az.eventgrid/new-azeventgridsubscription) command with `-EndpointType` set to `servicebustopic` and `-Endpoint` set to `/subscriptions/{AZURE SUBSCRIPTION}/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.ServiceBus/namespaces/<NAMESPACE NAME>/topics/<TOPIC NAME>`. Here's an example:
You can also use the [`New-AzEventGridSystemTopicEventSubscription`](/powershell/module/az.eventgrid/new-azeventgridsystemtopiceventsubscription) command for system topics, and the [`New-AzEventGridPartnerTopicEventSubscription`](/powershell/module/az.eventgrid/new-azeventgridpartnertopiceventsubscription) command for partner topics.
When sending an event to a Service Bus queue or topic as a brokered message, the `messageid` of the brokered message is an internal system ID.
55
90
56
91
The internal system ID for the message will be maintained across redelivery of the event so that you can avoid duplicate deliveries by turning on **duplicate detection** on the service bus entity. We recommend that you enable duration of the duplicate detection on the Service Bus entity to be either the time-to-live (TTL) of the event or max retry duration, whichever is longer.
57
92
93
+
## Delivery properties
94
+
Event subscriptions allow you to set up HTTP headers that are included in delivered events. This capability allows you to set custom headers that are required by a destination. You can set custom headers on the events that are delivered to Azure Service Bus queues and topics.
95
+
96
+
Azure Service Bus supports the use of following message properties when sending single messages.
97
+
98
+
| Header name | Header type |
99
+
| :-- | :-- |
100
+
|`MessageId`| Dynamic |
101
+
|`PartitionKey`| Static or dynamic |
102
+
|`SessionId`| Static or dynamic |
103
+
|`CorrelationId`| Static or dynamic |
104
+
|`Label`| Static or dynamic |
105
+
|`ReplyTo`| Static or dynamic |
106
+
|`ReplyToSessionId`| Static or dynamic |
107
+
|`To`|Static or dynamic |
108
+
|`ViaPartitionKey`| Static or dynamic |
109
+
110
+
> [!NOTE]
111
+
> - The default value of `MessageId` is the internal ID of the Event Grid event. You can override it. For example, `data.field`.
112
+
> - You can only set either `SessionId` or `MessageId`.
113
+
114
+
For more information, see [Custom delivery properties](delivery-properties.md).
115
+
58
116
## REST examples (for PUT)
59
117
60
118
### Service Bus queue
@@ -146,28 +204,6 @@ The internal system ID for the message will be maintained across redelivery of t
146
204
}
147
205
```
148
206
149
-
## Delivery properties
150
-
Event subscriptions allow you to set up HTTP headers that are included in delivered events. This capability allows you to set custom headers that are required by a destination. You can set custom headers on the events that are delivered to Azure Service Bus queues and topics.
151
-
152
-
Azure Service Bus supports the use of following message properties when sending single messages.
153
-
154
-
| Header name | Header type |
155
-
| :-- | :-- |
156
-
|`MessageId`| Dynamic |
157
-
|`PartitionKey`| Static or dynamic |
158
-
|`SessionId`| Static or dynamic |
159
-
|`CorrelationId`| Static or dynamic |
160
-
|`Label`| Static or dynamic |
161
-
|`ReplyTo`| Static or dynamic |
162
-
|`ReplyToSessionId`| Static or dynamic |
163
-
|`To`|Static or dynamic |
164
-
|`ViaPartitionKey`| Static or dynamic |
165
-
166
-
> [!NOTE]
167
-
> - The default value of `MessageId` is the internal ID of the Event Grid event. You can override it. For example, `data.field`.
168
-
> - You can only set either `SessionId` or `MessageId`.
169
-
170
-
For more information, see [Custom delivery properties](delivery-properties.md).
171
207
172
208
## Next steps
173
209
See the [Event handlers](event-handlers.md) article for a list of supported event handlers.
Copy file name to clipboardExpand all lines: articles/event-grid/handler-webhooks.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,7 @@ ms.date: 11/17/2022
6
6
---
7
7
8
8
# Webhooks, Automation runbooks, Logic Apps as event handlers for Azure Event Grid events
9
-
10
-
You can also use any WebHook as an event handler for events forwarded by Event Grid. The WebHook doesn't need to be hosted in Azure to handle events. Event Grid supports only HTTPS Webhook endpoints. You can also use an Azure Automation workbook or an Azure logic app as an event handler via webhooks. This article provides you links to conceptual, quickstart, and tutorial articles that provide you with more information.
9
+
An event handler receives events from an event source via Event Grid, and processes those events. You can use any WebHook as an event handler for events forwarded by Event Grid. The WebHook doesn't need to be hosted in Azure to handle events. Event Grid supports only HTTPS Webhook endpoints. You can also use an Azure Automation workbook or an Azure logic app as an event handler via webhooks. This article provides you links to conceptual, quickstart, and tutorial articles that provide you with more information.
11
10
12
11
> [!NOTE]
13
12
> Even though you can use **Webhook** as an **endpoint type** to configure an Azure function as an event handler, use **Azure Function** as an endpoint type. For more information, see [Azure function as an event handler](handler-functions.md).
0 commit comments