Send and receive messages from Azure Event Hubs using .Net Part 4 – Create a storage account as a checkpoint store

Now it’s time to create the storage account and get the connecting string for our .Net Core app.

First create the storage account by logging in to Azure CLI and place it in the same Resource Group and your Event Hub.

az storage account create \
     --name  \
     --resource-group storage-resource-group \
     --location westus \
     --sku Standard_RAGRS \
     --kind StorageV2

Next create the blob account. Go into Azure and select your new storage and create a blob container.

Finally copy the storage connection string for the storage account.

Now in the next post we’ll create our code and receive some Event Hub messages!

Send and receive messages from Azure Event Hubs using .Net Part 3 – Write the .Net console app for sending messages to the Azure Event Hub

Following the Microsoft Docs quickstart let’s write some code from their instructions!

Add the using statements in the programs.cs file

 using System;
 using System.Text;
 using System.Threading.Tasks;
 using Azure.Messaging.EventHubs;
 using Azure.Messaging.EventHubs.Producer;

Next go and get the namespace connection string and copy this so we can add the connection string to our code.

And inside the class add the constants and get the connection string and eventhub name from your event hub and copy them

private const string connectionString = "";
private const string eventHubName = "";

Finally replace the Main method with the method described in the link and build the project!

Now run the project and watch your three events being sent to your very own Azure Event Hub!

And inside your event hub you can now see the metrics updated.

Now in the next post we’ll create a storage and an app to receive the messages.

Send and receive messages with Azure Event Hubs using .NET Part 2 – Create the .NET Core console project for sending

Launch Visual Studio 2019 and create a C# .Net Core console app.

Now this first app will be the sender app so note the project and of the solution.

Open the Nuget Package console and add the nuget package as such.

Install-Package Azure.Messaging.EventHubs

There we go! Now in the next post we’ll write the code and watch our Event Hub update in the portal!

Send and receive messages with Azure Event Hubs using .NET Part 1 – Create an Event Hub

Let’s write some code and work with Azure Event Hubs. You can check out more about it here and here to view all the pre-requisites.

First jump over to the portal to create an Event Hub namespace.

Next go to the Event Hub namespace and create an event hub.

There you go! Next time we’ll download and add the event hub packages in visual studio.