Azure Service Bus In .NET Core 2.0

Problem

How to use Azure Service Bus in .NET Core.

Solution

Create a class library and add NuGet package - Microsoft.Azure.ServiceBus

Add a class to encapsulate settings.

Add a class to wrap functionality of sending messages to queue

Add a class to wrap the functionality of receiving messages from the queue.

Now, you can use these wrapper classes to send messages.

And receive messages.

NOTE

The sample code also includes wrappers for topics and subscriptions.

Discussion

The sample code will require you to setup Azure account and Service Bus. Instructions for these could be found here.

Source Code

GitHub


Similar Articles