[英]Deleting subscriptions from Azure Service Bus Topic through C#
Is there any way to delete subscriptions from Azure Service Bus Topic, through C# code?有没有办法通过 C# 代码从 Azure 服务总线主题中删除订阅? (I know how to delete it only through the Azure portal website)
(我知道怎么删除只能通过Azure门户网站)
I found that it can be done with ServiceBusAdministrationClient.DeleteSubscriptionAsync Method我发现可以用ServiceBusAdministrationClient.DeleteSubscriptionAsync 方法来完成
This can be done with the ManagementClient.DeleteSubscriptionAsync Method :这可以通过ManagementClient.DeleteSubscriptionAsync 方法完成:
Parameters
参数
topicPath : String主题路径:字符串
The name of the topic relative to the service namespace base address.相对于服务命名空间基地址的主题名称。
subscriptionName : String订阅名称:字符串
The name of the subscription to delete.要删除的订阅的名称。
Sample:样本:
Topic: lorem主题:lorem
Subscription: ipsum订阅:ipsum
var serviceBusConnectionString = "Endpoint=sb://sample.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=K34CMjptykdwvAT9t7Frz3DX8OlelvSOBWxZfW8oFZwPg=";
var managementClient = new ManagementClient(serviceBusConnectionString);
await managementClient.DeleteSubscriptionAsync("lorem", "ipsum");
NuGet: Azure Service Bus client library for .NET NuGet:Azure 服务总线客户端库,用于 .NET
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.