What's the equivalent of NamespaceManager.GetQueue.MessageCount in the new NET Standard Microsoft.Azure.ServiceBus?

前端 未结 3 1435
盖世英雄少女心
盖世英雄少女心 2021-01-18 10:30

What\'s the equivalent of NamespaceManager in the new NET Standard Microsoft.Azure.ServiceBus?

I\'ve used WindowsAzure.ServiceBus to do things like count messages in

相关标签:
3条回答
  • 2021-01-18 11:26

    You CAN read the queue message count:

    var managementClient = new ManagementClient(connectionString);
    (await managementClient.GetQueueRuntimeInfoAsync("name")).MessageCount;
    
    0 讨论(0)
  • 2021-01-18 11:28

    To provide an update:

    This is now implemented and available under the Microsoft.Azure.ServiceBus.Management; namespace.

    NamespaceManager is now called ManagementClient and has (roughly) the same endpoints available.

    Here's the class itself as part of the pull request to merge it into the main repository.

    0 讨论(0)
  • 2021-01-18 11:31

    You can't.

    The new API doesn't support reading message counts. You'd have to use Azure Monitor API to get them.

    Read why that's that case and how to work with Azure Monitor in Reading Azure Service Bus Metrics.

    0 讨论(0)
提交回复
热议问题