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/custom-event-to-eventhub.md
+13-12Lines changed: 13 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,27 @@
1
1
---
2
2
title: 'Quickstart: Send custom events to an event hub - Event Grid, Azure CLI'
3
3
description: Learn how to use Azure Event Grid and the Azure CLI to publish a topic and subscribe to that event, by using an event hub for the endpoint.
4
-
ms.date: 01/31/2024
4
+
ms.date: 06/24/2024
5
5
ms.topic: quickstart
6
6
ms.custom: devx-track-azurecli, mode-api
7
+
#customer intent: As a developer, I want to use Azure Event Grid to interact with an Azure Event Hubs subscription to support app interaction.
7
8
---
8
9
9
10
# Quickstart: Route custom events to an event hub by using Event Grid and the Azure CLI
10
11
11
-
[Azure Event Grid](overview.md) is a highly scalable and serverless event broker that you can use to integrate applications via events. Event Grid delivers events to [supported event handlers](event-handlers.md), and Azure Event Hubs is one of them.
12
-
13
12
In this quickstart, you use the Azure CLI to create an Event Grid custom topic and an Event Hubs subscription for that topic. You then send sample events to the custom topic and verify that those events are delivered to an event hub.
14
13
14
+
[Azure Event Grid](overview.md) is a highly scalable and serverless event broker that you can use to integrate applications via events. Event Grid delivers events to supported event handlers, such as Azure Event Hubs. [Event handlers](event-handlers.md).
Event Grid topics are Azure resources, and they must be placed in an Azure resource group. The resource group is a logical collection into which Azure resources are deployed and managed.
20
+
Event Grid topics are Azure resources. Create them in an Azure resource group. The resource group is a logical collection in which Azure resources are deployed and managed.
20
21
21
22
Create a resource group by using the [az group create](/cli/azure/group#az-group-create) command. The following example creates a resource group named `gridResourceGroup` in the `westus2` location.
22
23
23
-
Select **Open Cloud Shell** to open Azure Cloud Shell on the right pane. Select the **Copy** button to copy the command, paste it in Cloud Shell, and then select the Enter key to run the command.
24
+
Select **Open Cloud Shell** to open Azure Cloud Shell on the right pane. Select the **Copy** button to copy the command, paste it in Cloud Shell, and then select the **Enter** key to run the command.
24
25
25
26
```azurecli-interactive
26
27
az group create --name gridResourceGroup --location westus2
@@ -43,7 +44,7 @@ Replace `<TOPIC NAME>` with a unique name for your custom topic. The Event Grid
43
44
1. Run the following command to create the topic:
44
45
45
46
```azurecli-interactive
46
-
az eventgrid topic create --name $topicname -l westus2 -g gridResourceGroup
47
+
az eventgrid topic create --name $topicname --location westus2 --resource-group gridResourceGroup
47
48
```
48
49
49
50
## Create an event hub
@@ -67,7 +68,7 @@ Before you subscribe to the custom topic, create the endpoint for the event mess
67
68
68
69
## Subscribe to a custom topic
69
70
70
-
You subscribe to an Event Grid topic to tell Event Grid which events you want to track. The following example subscribes to the custom topic that you created, and it passes the resource ID of the event hub for the endpoint. The endpoint is in this format:
71
+
You subscribe to an Event Grid topic to tell Event Grid which events you want to track. The following example subscribes to the custom topic that you created. It passes the resource ID of the event hub for the endpoint. The endpoint is in this format:
71
72
72
73
`/subscriptions/<AZURE SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.EventHub/namespaces/<NAMESPACE NAME>/eventhubs/<EVENT HUB NAME>`
For the sake of simplicity in this article, you use sample event data to send to the custom topic. Typically, an application or an Azure service would send the event data.
99
+
For simplicity, this article uses sample event data to send to the custom topic. Typically, an application or an Azure service would send the event data.
99
100
100
101
The cURL tool sends HTTP requests. In this article, you use cURL to send the event to the custom topic. The following example sends three events to the Event Grid topic:
101
102
@@ -107,19 +108,19 @@ do
107
108
done
108
109
```
109
110
110
-
In the Azure portal, on the **Overview** page for your Event Hubs namespace, notice that Event Grid sent those three events to the event hub. You see the same chart on the **Overview** page for the `demohub` Event Hubs instance.
111
+
In the Azure portal, the **Overview** page for your Event Hubs namespace shows that Event Grid sent those three events to the event hub. You see the same chart on the **Overview** page for the `demohub` Event Hubs instance.
111
112
112
113
:::image type="content" source="./media/custom-event-to-eventhub/show-result.png" lightbox="./media/custom-event-to-eventhub/show-result.png" alt-text="Screenshot that shows the portal page with an incoming message count of 3.":::
113
114
114
115
Typically, you create an application that retrieves event messages from the event hub. For more information, see:
115
116
116
-
-[Get started receiving messages with the event processor host in .NET Standard](../event-hubs/event-hubs-dotnet-standard-getstarted-send.md)
117
+
-[Send events to and receive events from Azure Event Hubs using .NET](../event-hubs/event-hubs-dotnet-standard-getstarted-send.md)
117
118
-[Receive events from Azure Event Hubs by using Java](../event-hubs/event-hubs-java-get-started-send.md)
118
119
-[Receive events from Event Hubs by using Apache Storm](../event-hubs/event-hubs-storm-getstarted-receive.md)
119
120
120
121
## Clean up resources
121
122
122
-
If you plan to continue working with this event, don't clean up the resources that you created in this article. Otherwise, use the following command to delete the resources:
123
+
If you plan to continue working with this custom topic and subscription, don't remove the resources that you created in this article. Otherwise, use the following command to delete the resources:
123
124
124
125
```azurecli-interactive
125
126
az group delete --name gridResourceGroup
@@ -132,7 +133,7 @@ Now that you know how to create topics and event subscriptions, learn more about
132
133
-[About Event Grid](overview.md)
133
134
-[Route Azure Blob Storage events to a custom web endpoint](../storage/blobs/storage-blob-event-quickstart.md?toc=%2fazure%2fevent-grid%2ftoc.json)
134
135
-[Monitor virtual machine changes with Azure Event Grid and Logic Apps](monitor-virtual-machine-changes-logic-app.md)
135
-
-[Stream big data into a data warehouse](event-hubs-integration.md)
136
+
-[Migrate Event Hubs captured data from Azure Storage to Azure Synapse Analytics](event-hubs-integration.md)
136
137
137
138
To learn about publishing events to, and consuming events from, Event Grid by using various programming languages, see the following samples:
0 commit comments