- Open Visual Studio and create a new console application using the context menu File | New Project | Console Application.
- The next step is to add a NuGet Package Microsoft.Azure.EventHubs to this project.
- To add this, right-click on the Project option with Solution Explorer, and select the context menu option, Manage NuGet Packages.
- Now, search for the Microsoft.Azure.EventHubs NuGet package and add it to the solution.
- Now, open the Program.cs file.
- Add two constant strings to define the Event Hub connection string and even the hub name:
private const string EhConnectionString = "[Add connection string]";private const string EhEntityPath = "[Add event hub name]";
- Add the following ...