Create a .NET Core console application Part 3 – Add code to your application

Open the program.cs file to add code to your application.

notepad .\Program.cs

Edit the code to ourput the current datetime. Then save the file.

using System;

namespace myApp
    class Program
        static void Main(string[] args)
            Console.WriteLine("Hello World!");
	    Console.WriteLine("The current time is " + DateTime.Now);

Time to run your application once again!

Great work! Now go and build some .NET apps!

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 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.