Skip to content

Commit cd48816

Browse files
committed
Freshness review & update - Event Hubs
1 parent 3ebaeae commit cd48816

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

articles/event-hubs/event-hubs-dotnet-standard-getstarted-send.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ title: 'Quickstart: Send or receive events using .NET'
33
description: A quickstart that shows you how to create a .NET Core application that sends events to and receive events from Azure Event Hubs.
44
ms.topic: quickstart
55
ms.service: event-hubs
6-
ms.date: 03/09/2023
6+
ms.date: 04/05/2024
77
ms.devlang: csharp
88
ms.custom: devx-track-csharp, mode-api, passwordless-dotnet, devx-track-dotnet
9+
#customer intent: As a .NET developer, I want to learn how to send events to an event hub and receive events from the event hub using C#.
910
---
1011

1112
# Quickstart: Send events to and receive events from Azure Event Hubs using .NET
1213
In this quickstart, you learn how to send events to an event hub and then receive those events from the event hub using the **Azure.Messaging.EventHubs** .NET library.
1314

1415
> [!NOTE]
15-
> Quickstarts are for you to quickly ramp up on the service. If you are already familiar with the service, you may want to see .NET samples for Event Hubs in our .NET SDK repository on GitHub: [Event Hubs samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/eventhub/Azure.Messaging.EventHubs/samples), [Event processor samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/eventhub/Azure.Messaging.EventHubs.Processor/samples).
16+
> Quickstarts are for you to quickly ramp up on the service. If you are already familiar with the service, you might want to see .NET samples for Event Hubs in our .NET SDK repository on GitHub: [Event Hubs samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/eventhub/Azure.Messaging.EventHubs/samples), [Event processor samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/eventhub/Azure.Messaging.EventHubs.Processor/samples).
1617
1718
## Prerequisites
1819
If you're new to Azure Event Hubs, see [Event Hubs overview](event-hubs-about.md) before you go through this quickstart.
@@ -185,7 +186,10 @@ This section shows you how to create a .NET Core console application to send eve
185186
```csharp
186187
A batch of 3 events has been published.
187188
```
188-
4. On the **Event Hubs Namespace** page in the Azure portal, you see three incoming messages in the **Messages** chart. Refresh the page to update the chart if needed. It may take a few seconds for it to show that the messages have been received.
189+
190+
> [!IMPORTANT]
191+
> If you are using the Passwordless (Azure Active Directory's Role-based Access Control) authentication, select **Tools**, then select **Options**. In the **Options** window, expand **Azure Service Authentication**, and select **Account Selection**. Confirm that you are using the account that was added to the **Azure Event Hubs Data Owner** role on the Event Hubs namespace.
192+
4. On the **Event Hubs Namespace** page in the Azure portal, you see three incoming messages in the **Messages** chart. Refresh the page to update the chart if needed. It might take a few seconds for it to show that the messages have been received.
189193
190194
:::image type="content" source="./media/getstarted-dotnet-standard-send-v2/verify-messages-portal.png" alt-text="Image of the Azure portal page to verify that the event hub received the events" lightbox="./media/getstarted-dotnet-standard-send-v2/verify-messages-portal.png":::
191195
@@ -212,7 +216,7 @@ In this quickstart, you use Azure Storage as the checkpoint store. Follow these
212216
213217
[Get the connection string to the storage account](../storage/common/storage-account-get-info.md#get-a-connection-string-for-the-storage-account)
214218
215-
Note down the connection string and the container name. You use them in the receive code.
219+
Note down the connection string and the container name. You use them in the code to receive events from the event hub.
216220
217221
---
218222
### Create a project for the receiver
@@ -365,7 +369,6 @@ Replace the contents of **Program.cs** with the following code:
365369
{
366370
// Write the body of the event to the console window
367371
Console.WriteLine("\tReceived event: {0}", Encoding.UTF8.GetString(eventArgs.Data.Body.ToArray()));
368-
Console.ReadLine();
369372
return Task.CompletedTask;
370373
}
371374
@@ -374,7 +377,6 @@ Replace the contents of **Program.cs** with the following code:
374377
// Write details about the error to the console window
375378
Console.WriteLine($"\tPartition '{eventArgs.PartitionId}': an unhandled exception was encountered. This was not expected to happen.");
376379
Console.WriteLine(eventArgs.Exception.Message);
377-
Console.ReadLine();
378380
return Task.CompletedTask;
379381
}
380382
```
@@ -386,15 +388,15 @@ Replace the contents of **Program.cs** with the following code:
386388
> [!NOTE]
387389
> For the complete source code with more informational comments, see [this file on the GitHub](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/eventhub/Azure.Messaging.EventHubs.Processor/samples/Sample01_HelloWorld.md).
388390
3. Run the receiver application.
389-
4. You should see a message that the events have been received.
391+
4. You should see a message that the events have been received. Press ENTER after you see a received event message.
390392
391393
```bash
392394
Received event: Event 1
393395
Received event: Event 2
394396
Received event: Event 3
395397
```
396398
These events are the three events you sent to the event hub earlier by running the sender program.
397-
5. In the Azure portal, you can verify that there are three outgoing messages, which Event Hubs sent to the receiving application. Refresh the page to update the chart. It may take a few seconds for it to show that the messages have been received.
399+
5. In the Azure portal, you can verify that there are three outgoing messages, which Event Hubs sent to the receiving application. Refresh the page to update the chart. It might take a few seconds for it to show that the messages have been received.
398400
399401
:::image type="content" source="./media/getstarted-dotnet-standard-send-v2/verify-messages-portal-2.png" alt-text="Image of the Azure portal page to verify that the event hub sent events to the receiving app" lightbox="./media/getstarted-dotnet-standard-send-v2/verify-messages-portal-2.png":::
400402
@@ -405,8 +407,6 @@ Azure Schema Registry of Event Hubs provides a centralized repository for managi
405407
406408
To learn more, see [Validate schemas with Event Hubs SDK](schema-registry-dotnet-send-receive-quickstart.md).
407409
408-
## Clean up resources
409-
Delete the resource group that has the Event Hubs namespace or delete only the namespace if you want to keep the resource group.
410410
411411
## Samples and reference
412412
This quick start provides step-by-step instructions to implement a scenario of sending a batch of events to an event hub and then receiving them. For more samples, select the following links.
@@ -417,7 +417,10 @@ This quick start provides step-by-step instructions to implement a scenario of s
417417
418418
For complete .NET library reference, see our [SDK documentation](/dotnet/api/overview/azure/event-hubs).
419419
420-
## Next steps
420+
## Clean up resources
421+
Delete the resource group that has the Event Hubs namespace or delete only the namespace if you want to keep the resource group.
422+
423+
## Related content
421424
See the following tutorial:
422425
423426
> [!div class="nextstepaction"]

0 commit comments

Comments
 (0)