Skip to content

Commit 5fe72e7

Browse files
authored
Merge pull request #114218 from spelluru/egridhandlers0506
Event handlers
2 parents c4e0a67 + b7eb5c5 commit 5fe72e7

12 files changed

+315
-144
lines changed

articles/event-grid/event-handlers.md

Lines changed: 10 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -11,128 +11,17 @@ ms.author: spelluru
1111
---
1212

1313
# Event handlers in Azure Event Grid
14+
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. You can also use any webhook for handling events. The webhook doesn't need to be hosted in Azure to handle events. Event Grid only supports HTTPS webhook endpoints.
1415

15-
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. You can also use any WebHook for handling events. The WebHook doesn't need to be hosted in Azure to handle events. Event Grid only supports HTTPS WebHook endpoints.
16+
## Supported event handlers
17+
Here are the supported event handlers:
1618

17-
This article provides links to content for each event handler.
18-
19-
## Azure Automation
20-
21-
Use Azure Automation to process events with automated runbooks.
22-
23-
|Title |Description |
24-
|---------|---------|
25-
|[Tutorial: Azure Automation with Event Grid and Microsoft Teams](ensure-tags-exists-on-new-virtual-machines.md) |Create a virtual machine, which sends an event. The event triggers an Automation runbook that tags the virtual machine, and triggers a message that is sent to a Microsoft Teams channel. |
26-
27-
## Azure Functions
28-
29-
Use Azure Functions for serverless response to events.
30-
31-
When using Azure Functions as the handler, use the Event Grid trigger instead of generic HTTP triggers. Event Grid automatically validates Event Grid Function triggers. With generic HTTP triggers, you must implement the [validation response](webhook-event-delivery.md).
32-
33-
|Title |Description |
34-
|---------|---------|
35-
| [Quickstart: Handle events with function](custom-event-to-function.md) | Sends a custom event to a function for processing. |
36-
| [Event Grid trigger for Azure Functions](../azure-functions/functions-bindings-event-grid.md) | Overview of using the Event Grid trigger in Functions. |
37-
| [Tutorial: automate resizing uploaded images using Event Grid](resize-images-on-storage-blob-upload-event.md) | Users upload images through web app to storage account. When a storage blob is created, Event Grid sends an event to the function app, which resizes the uploaded image. |
38-
| [Tutorial: stream big data into a data warehouse](event-grid-event-hubs-integration.md) | When Event Hubs creates a Capture file, Event Grid sends an event to a function app. The app retrieves the Capture file and migrates data to a data warehouse. |
39-
| [Tutorial: Azure Service Bus to Azure Event Grid integration examples](../service-bus-messaging/service-bus-to-event-grid-integration-example.md?toc=%2fazure%2fevent-grid%2ftoc.json) | Event Grid sends messages from Service Bus topic to function app and logic app. |
40-
41-
## Event Hubs
42-
43-
Use Event Hubs when your solution gets events faster than it can process the events. Your application processes the events from Event Hubs at it own schedule. You can scale your event processing to handle the incoming events.
44-
45-
Event Hubs can act as either an event source or event handler. The following article shows how to use Event Hubs as a handler.
46-
47-
|Title |Description |
48-
|---------|---------|
49-
| [Quickstart: route custom events to Azure Event Hubs with Azure CLI and Event Grid](custom-event-to-eventhub.md) | Sends a custom event to an event hub for processing by an application. |
50-
| [Resource Manager template: custom topic and Event Hubs endpoint](https://github.com/Azure/azure-quickstart-templates/tree/master/101-event-grid-event-hubs-handler)| A Resource Manager template that creates a subscription for a custom topic. It sends events to an Azure Event Hubs. |
51-
52-
## Hybrid Connections
53-
54-
Use Azure Relay Hybrid Connections to send events to applications that are within an enterprise network and don't have a publicly accessible endpoint.
55-
56-
|Title |Description |
57-
|---------|---------|
58-
| [Tutorial: send events to hybrid connection](custom-event-to-hybrid-connection.md) | Sends a custom event to an existing hybrid connection for processing by a listener application. |
59-
60-
## Logic Apps
61-
62-
Use Logic Apps to automate business processes for responding to events.
63-
64-
|Title |Description |
65-
|---------|---------|
66-
| [Tutorial: monitor virtual machine changes with Azure Event Grid and Logic Apps](monitor-virtual-machine-changes-event-grid-logic-app.md) | A logic app monitors changes to a virtual machine and sends emails about those changes. |
67-
| [Tutorial: send email notifications about Azure IoT Hub events using Logic Apps](publish-iot-hub-events-to-logic-apps.md) | A logic app sends a notification email every time a device is added to your IoT hub. |
68-
| [Tutorial: Azure Service Bus to Azure Event Grid integration examples](../service-bus-messaging/service-bus-to-event-grid-integration-example.md?toc=%2fazure%2fevent-grid%2ftoc.json) | Event Grid sends messages from Service Bus topic to function app and logic app. |
69-
70-
## Service Bus
71-
72-
### Service Bus queues
73-
74-
You can route events in Event Grid directly to Service Bus queues for use in buffering or command & control scenarios in enterprise applications.
75-
76-
In the Azure portal, while creating an event subscription, select "Service Bus Queue" as endpoint type and then click "select an endpoint" in order to choose a Service Bus queue.
77-
78-
#### Using CLI to add a Service Bus queue handler
79-
80-
For Azure CLI, the following example subscribes and connects an event grid topic to a Service Bus queue:
81-
82-
```azurecli-interactive
83-
# If you haven't already installed the extension, do it now.
84-
# This extension is required for preview features.
85-
az extension add --name eventgrid
86-
87-
az eventgrid event-subscription create \
88-
--name <my-event-subscription> \
89-
--source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
90-
--endpoint-type servicebusqueue \
91-
--endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ns1/queues/queue1
92-
```
93-
94-
### Service Bus topics
95-
96-
You can route events in Event Grid directly to Service Bus topics in order to handle Azure system events with Service Bus topics, or for command & control messaging scenarios.
97-
98-
In the Azure portal, while creating an event subscription, select "Service Bus Topic" as endpoint type and then click "select and endpoint" in order to choose a Service Bus topic.
99-
100-
#### Using CLI to add a Service Bus topic handler
101-
102-
For Azure CLI, the following example subscribes and connects an event grid topic to a Service Bus queue:
103-
104-
```azurecli-interactive
105-
# If you haven't already installed the extension, do it now.
106-
# This extension is required for preview features.
107-
az extension add --name eventgrid
108-
109-
az eventgrid event-subscription create \
110-
--name <my-event-subscription> \
111-
--source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
112-
--endpoint-type servicebustopic \
113-
--endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ns1/topics/topic1
114-
```
115-
116-
## Queue Storage
117-
118-
Use Queue storage to receive events that need to be pulled. You might use Queue storage when you have a long running process that takes too long to respond. By sending events to Queue storage, the app can pull and process events on its own schedule.
119-
120-
|Title |Description |
121-
|---------|---------|
122-
| [Quickstart: route custom events to Azure Queue storage with Azure CLI and Event Grid](custom-event-to-queue-storage.md) | Describes how to send custom events to a Queue storage. |
123-
124-
## WebHooks
125-
126-
Use webhooks for customizable endpoints that respond to events.
127-
128-
|Title |Description |
129-
|---------|---------|
130-
| Quickstart: create and route custom events with - [Azure CLI](custom-event-quickstart.md), [PowerShell](custom-event-quickstart-powershell.md), and [portal](custom-event-quickstart-portal.md). | Shows how to send custom events to a WebHook. |
131-
| Quickstart: route Blob storage events to a custom web endpoint with - [Azure CLI](../storage/blobs/storage-blob-event-quickstart.md?toc=%2fazure%2fevent-grid%2ftoc.json), [PowerShell](../storage/blobs/storage-blob-event-quickstart-powershell.md?toc=%2fazure%2fevent-grid%2ftoc.json), and [portal](blob-event-quickstart-portal.md). | Shows how to send blob storage events to a WebHook. |
132-
| [Quickstart: send container registry events](../container-registry/container-registry-event-grid-quickstart.md?toc=%2fazure%2fevent-grid%2ftoc.json) | Shows how to use Azure CLI to send Container Registry events. |
133-
| [Overview: receive events to an HTTP endpoint](receive-events.md) | Describes how to validate an HTTP endpoint to receive events from an Event Subscription, and receive and deserialize events. |
19+
- [Webhooks](handler-webhooks.md). Azure Automation runbooks and Logic Apps are supported via webhooks.
20+
- [Azure functions](handler-functions.md)
21+
- [Event hubs](handler-event-hubs.md)
22+
- [Relay hybrid connections](handler-relay-hybrid-connections.md)
23+
- [Service Bus queues and topics](handler-service-bus.md)
24+
- [Storage queues](handler-storage-queues.md)
13425

13526
## Next steps
136-
137-
* For an introduction to Event Grid, see [About Event Grid](overview.md).
138-
* To quickly get started using Event Grid, see [Create and route custom events with Azure Event Grid](custom-event-quickstart.md).
27+
- For an introduction to Event Grid, see [About Event Grid](overview.md).
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Event hub as an event handler for Azure Event Grid events
3+
description: Describes how you can use event hubs as event handlers for Azure Event Grid events.
4+
services: event-grid
5+
author: spelluru
6+
7+
ms.service: event-grid
8+
ms.topic: conceptual
9+
ms.date: 05/11/2020
10+
ms.author: spelluru
11+
---
12+
13+
# Event hub as an event handler for Azure Event Grid events
14+
An event handler is the place where the event is sent. The handler takes an action to process the event. Several Azure services are automatically configured to handle events and **Azure Event Hubs** is one of them.
15+
16+
Use **Event Hubs** when your solution gets events from Event Grid faster than it can process the events. Once the events are in an event hub, your application can process events from the event hub at its own schedule. You can scale your event processing to handle the incoming events.
17+
18+
## Tutorials
19+
See the following examples:
20+
21+
|Title |Description |
22+
|---------|---------|
23+
| [Quickstart: Route custom events to Azure Event Hubs with Azure CLI](custom-event-to-eventhub.md) | Sends a custom event to an event hub for processing by an application. |
24+
| [Resource Manager template: Create an Event Grid custom topic and send events to an event hub](https://github.com/Azure/azure-quickstart-templates/tree/master/101-event-grid-event-hubs-handler)| A Resource Manager template that creates a subscription for a custom topic. It sends events to an Azure Event Hubs. |
25+
26+
## Message properties
27+
If you use an **event hub** as an event handler for events from Event Grid, set the following message headers:
28+
29+
| Property name | Description |
30+
| ------------- | ----------- |
31+
| aeg-subscription-name | Name of event subscription. |
32+
| aeg-delivery-count | <p>Number of attempts made for the event.</p> <p>Example: "1"</p> |
33+
| aeg-event-type | <p>Type of the event.</p><p> Example: "Microsoft.Storage.blobCreated"</p> |
34+
| aeg-metadata-version | <p>Metadata version of the event.</p> <p>Example: "1".</p><p> For **Event Grid event schema**, this property represents the metadata version and for **cloud event schema**, it represents the **spec version**. </p>|
35+
| aeg-data-version | <p>Data version of the event.</p><p>Example: "1".</p><p>For **Event Grid event schema**, this property represents the data version and for **cloud event schema**, it doesn't apply.</p> |
36+
| aeg-output-event-id | ID of the Event Grid event. |
37+
38+
39+
## Next steps
40+
See the [Event handlers](event-handlers.md) article for a list of supported event handlers.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Azure function as an event handler for Azure Event Grid events
3+
description: Describes how you can use Azure functions as event handlers for Event Grid events.
4+
services: event-grid
5+
author: spelluru
6+
7+
ms.service: event-grid
8+
ms.topic: conceptual
9+
ms.date: 05/11/2020
10+
ms.author: spelluru
11+
---
12+
13+
# Azure function as an event handler for Event Grid events
14+
15+
An event handler is the place where the event is sent. The handler takes an action to process the event. Several Azure services are automatically configured to handle events and **Azure Functions** is one of them.
16+
17+
Use **Azure Functions** in a serverless architecture to respond to events from Event Grid. When using an Azure function as the handler, use the Event Grid trigger instead of the generic HTTP trigger. Event Grid automatically validates Event Grid triggers. With generic HTTP triggers, you must implement the [validation response](webhook-event-delivery.md) yourself.
18+
19+
For more information, see [Event Grid trigger for Azure Functions](../azure-functions/functions-bindings-event-grid.md) for an overview of using the Event Grid trigger in functions.
20+
21+
## Tutorials
22+
23+
|Title |Description |
24+
|---------|---------|
25+
| [Quickstart: Handle events with function](custom-event-to-function.md) | Sends a custom event to a function for processing. |
26+
| [Tutorial: automate resizing uploaded images using Event Grid](resize-images-on-storage-blob-upload-event.md) | Users upload images through web app to storage account. When a storage blob is created, Event Grid sends an event to the function app, which resizes the uploaded image. |
27+
| [Tutorial: stream big data into a data warehouse](event-grid-event-hubs-integration.md) | When Event Hubs creates a Capture file, Event Grid sends an event to a function app. The app retrieves the Capture file and migrates data to a data warehouse. |
28+
| [Tutorial: Azure Service Bus to Azure Event Grid integration examples](../service-bus-messaging/service-bus-to-event-grid-integration-example.md?toc=%2fazure%2fevent-grid%2ftoc.json) | Event Grid sends messages from Service Bus topic to a function app and a logic app. |
29+
30+
31+
## Next steps
32+
See the [Event handlers](event-handlers.md) article for a list of supported event handlers.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Relay Hybrid connection as an event handler for Azure Event Grid events
3+
description: Describes how you can use Azure Relay hybrid connections as event handlers for Azure Event Grid events.
4+
services: event-grid
5+
author: spelluru
6+
7+
ms.service: event-grid
8+
ms.topic: conceptual
9+
ms.date: 05/11/2020
10+
ms.author: spelluru
11+
---
12+
13+
# Relay Hybrid connection as an event handler for Azure Event Grid events
14+
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 Relay** is one of them.
15+
16+
Use Azure **Relay Hybrid Connections** to send events to applications that are within an enterprise network and don't have a publicly accessible endpoint.
17+
18+
## Tutorials
19+
See the following tutorial for an example of using an Azure Relay hybrid connection as an event handler.
20+
21+
|Title |Description |
22+
|---------|---------|
23+
| [Tutorial: send events to hybrid connection](custom-event-to-hybrid-connection.md) | Sends a custom event to an existing hybrid connection for processing by a listener application. |
24+
25+
## Next steps
26+
See the [Event handlers](event-handlers.md) article for a list of supported event handlers.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Service Bus queues and topics as event handlers for Azure Event Grid events
3+
description: Describes how you can use Service Bus queues and topics as event handlers for Azure Event Grid events.
4+
services: event-grid
5+
author: spelluru
6+
7+
ms.service: event-grid
8+
ms.topic: conceptual
9+
ms.date: 05/11/2020
10+
ms.author: spelluru
11+
---
12+
13+
# Service Bus queues and topics as event handlers for Azure Event Grid events
14+
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.
15+
16+
You can use a Service queue or topic as a handler for events from Event Grid.
17+
18+
## Service Bus queues
19+
You can route events in Event Grid directly to Service Bus queues for use in buffering or command & control scenarios in enterprise applications.
20+
21+
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.
22+
23+
### Using CLI to add a Service Bus queue handler
24+
25+
For Azure CLI, the following example subscribes and connects an event grid topic to a Service Bus queue:
26+
27+
```azurecli-interactive
28+
az eventgrid event-subscription create \
29+
--name <my-event-subscription> \
30+
--source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
31+
--endpoint-type servicebusqueue \
32+
--endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ns1/queues/queue1
33+
```
34+
35+
## Service Bus topics
36+
37+
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.
38+
39+
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.
40+
41+
### Using CLI to add a Service Bus topic handler
42+
43+
For Azure CLI, the following example subscribes and connects an event grid topic to a Service Bus queue:
44+
45+
```azurecli-interactive
46+
az eventgrid event-subscription create \
47+
--name <my-event-subscription> \
48+
--source-resource-id /subscriptions/{SubID}/resourceGroups/{RG}/providers/Microsoft.EventGrid/topics/topic1 \
49+
--endpoint-type servicebustopic \
50+
--endpoint /subscriptions/{SubID}/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ns1/topics/topic1
51+
```
52+
53+
## Message properties
54+
If you use a **Service Bus topic or queue** as an event handler for events from Event Grid, set the following message headers:
55+
56+
| Property name | Description |
57+
| ------------- | ----------- |
58+
| aeg-subscription-name | Name of event subscription. |
59+
| aeg-delivery-count | <p>Number of attempts made for the event.</p> <p>Example: "1"</p> |
60+
| aeg-event-type | <p>Type of the event.</p><p> Example: "Microsoft.Storage.blobCreated"</p> |
61+
| aeg-metadata-version | <p>Metadata version of the event.</p> <p>Example: "1".</p><p> For **Event Grid event schema**, this property represents the metadata version and for **cloud event schema**, it represents the **spec version**. </p>|
62+
| aeg-data-version | <p>Data version of the event.</p><p>Example: "1".</p><p>For **Event Grid event schema**, this property represents the data version and for **cloud event schema**, it doesn't apply.</p> |
63+
64+
## Message headers
65+
When sending an event to a Service Bus queue or topic as a brokered message, the `messageid` of the brokered message is the **event ID**.
66+
67+
The event ID 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.
68+
69+
## Next steps
70+
See the [Event handlers](event-handlers.md) article for a list of supported event handlers.

0 commit comments

Comments
 (0)