Azure-sdk-for-net: Service Bus: want to manage topics and subscriptions via connection string

Created on 24 Jul 2017  路  11Comments  路  Source: Azure/azure-sdk-for-net

I'm trying to use Azure Service Bus pub/sub from .NET Core, by upgrading my net451 wrapper library to netstandard13/16.

On guidance from https://github.com/azure/azure-service-bus-dotnet, I'm looking at Microsoft.Azure.Management.ServiceBus.

Previously, I could do this:

```c#
NamespaceManager = NamespaceManager.CreateFromConnectionString(ConnectionString);

  // then...
  if (!NamespaceManager.TopicExists(name))
  {
      if (createIfNecessary)
      {
          NamespaceManager.CreateTopic(name);
      }
  }

```

Now, it looks like I have Microsoft.Azure.Management.ServiceBus.ServiceBusManagementClient.Topics.Get, which immediately wants a resource group.

All I have is a connection string with Endpoint, SharedAccessKeyName and SharedAccessKey.

Is there a .NET Core equivalent for what I'm trying here?

Client Service Bus

Most helpful comment

Hi @kierenj:

As @SeanFeldman mentioned, this is possible in the current version of the Service Bus client library, which has a embedded management surface in the Microsoft.Azure.ServiceBus.Management namespace. For starting off, you may want to have a look at the ManagementClient for the API reference and the ServiceBusScope class in the test suite for a usage example.

All 11 comments

I'm keen to proceed with some development work - would it be possible to triage this one but indicating whether what I'm after is possible? If not, I can get cracking with a route other than .NET Core? Thank you.

Maybe just an ETA on an initial "possible/not possible" response?

Any other route (paid support / twitter / forums) that might be able to help me get unblocked?

@kierenj Did you ever find a solution to this? I have exactly the same question and have been having difficulty finding answers.

Nope - I'm disappointed in two ways... slightly because I don't have a solution, and massively because no-one responded to give me a way forward.

I mean, I thought Azure and .NET Core were a big deal. I figured someone would be triaging issues? @hovsepm any official word? In terms of getting a response, not necessarily implementing anything, though that would be a bonus..

I actually just found this thread discussing a couple of semi-related issues, with this among them. The latest update from the developers is 10 days ago. Most of the conversation has been focusing on what the management library can/cannot do, but ASB management via connection string has been part of the conversation.

just found this .... while searching
https://stackoverflow.com/questions/49421196/programatically-create-service-bus-subscription-using-net-standard

private async Task CreateTopicSubscriptions()
{
var client = new ManagementClient(ServiceBusConnectionString);
for (int i = 0; i < Subscriptions.Length; i++)
{
if (!await client.SubscriptionExistsAsync(TopicName, Subscriptions[i]))
{
await client.CreateSubscriptionAsync(new SubscriptionDescription(TopicName, Subscriptions[i]));
}
}
}

This issue should be closed.

@kierenj have you seen the ManagementClient available as of v3 of the client?

cc @jsquire

Hi @kierenj:

As @SeanFeldman mentioned, this is possible in the current version of the Service Bus client library, which has a embedded management surface in the Microsoft.Azure.ServiceBus.Management namespace. For starting off, you may want to have a look at the ManagementClient for the API reference and the ServiceBusScope class in the test suite for a usage example.

Was this page helpful?
0 / 5 - 0 ratings