Mossharbor / AzureWorkArounds.ServiceBus

Implmentations of Missing Dotnet Core Azure Service Bus functionality around Queues/Topics/Subsccriptions/Event Hubs
MIT License
6 stars 4 forks source link

Mossharbor.AzureWorkArounds.ServiceBus

The last version of the Azure Service Bus Api's (Microsoft.Azure.ServiceBus) are missing functionality that used to exist in the non-dotnet core libaries (mainly WindowsAzure.ServiceBus).
This missing functionality involves the CRUD operations on Azure Queue's/Topics/Subscriptions and Event Hubs.

This library adds those operations back in a donet standard 2.0 compatible library.

you can see a discussion of the issue here

Install the nuget package: Install-Package Mossharbor.AzureWorkArounds.ServiceBus

Example:

string name = "testSubscription";
string topicName = "testTopicSubscription";
NamespaceManager ns = NamespaceManager.CreateFromConnectionString(serviceBusConnectionString);
TopicDescription tdescription = ns.CreateTopic(topicName);
SubscriptionDescription sdescription = ns.CreateSubscription(topicName, "testSubscription");

if (!ns.SubscriptionExists(topicName, name, out sdescription))
     Assert.Fail("Subscription did not exist");
else
{
    Assert.IsTrue(null != sdescription);
    ns.DeleteSubscription(topicName, name);
    if (ns.SubscriptionExists(topicName, name, out sdescription))
         Assert.Fail("Subscription was not deleted");

    ns.DeleteTopic(topicName);
    if (ns.TopicExists(name, out tdescription))
        Assert.Fail("Topic was not deleted");
}