简体   繁体   English

如何检查Azure Service Bus是否具有高级定价

[英]How to check if a Azure Service Bus has Premium Pricing

In one of my Azure Web Apps I create an Azure Topic when it doesn't exist yet during the warmup(start) of our Azure Web App. 在我的一个Azure Web Apps中,我在Azure Web App的热身(启动)过程中创建一个尚不存在的Azure主题。

On topic creation time I want to know whether the service bus has a premium pricing tier, when yes I want to disable express, when no (standard pricing tier) I want to enable express, to prevent exceptions. 关于主题创建时间,我想知道服务总线是否具有高级定价层,是的话我要禁用快速交易,何时不存在(标准定价层)我要启用快速交易以防止例外。

Is there a defensive way to check if a premium pricing tier is available on the service bus (for example: using the service bus connection string) ? 有没有防御性的方法来检查服务总线上是否有可用的高级定价层(例如:使用服务总线连接字符串)?

When there is no defensive way, I can always catch the web exception that know raises, but I want to prevent the exception if I can. 如果没有防御方法,我总是可以捕获已知引发的Web异常,但是如果可以的话,我想阻止该异常。

Edit: After consulting our lead-dev we decided to skip the EnableExpress setting completely in our DTAP. 编辑:在咨询了我们的开发人员之后,我们决定完全跳过DTAP中的EnableExpress设置。 So I don't need to implement the SKU check at all. 因此,我根本不需要实施SKU检查。 Be aware to not set the EnableExpress property at all otherwise you get the webexception in Premium SKU. 请注意,根本不要设置EnableExpress属性,否则您将在Premium SKU中获得webexception。

Is there a defensive way to check if a premium pricing tier is available on the service bus (for example: using the service bus connection string)? 有没有一种防御性的方法来检查服务总线上是否有可用的高级定价层(例如:使用服务总线连接字符串)?

Unfortunately there's none as of today. 不幸的是,到目前为止还没有。 Service Bus Client SDK does not expose this information. Service Bus Client SDK不会公开此信息。 This feature has been asked from the Service Bus team and there's an open issue on Github for that: https://github.com/Azure/azure-service-bus/issues/42 . 服务总线团队已要求此功能,并且在Github上存在一个未解决的问题: https : //github.com/Azure/azure-service-bus/issues/42

The differences between Premium and Standard tiers are highlighted here: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-premium-messaging . PremiumStandard层之间的区别在此处突出显示: https : //docs.microsoft.com/zh-cn/azure/service-bus-messaging/service-bus-premium-messaging Kind of an anti-pattern but one thing you could do is perform and operation that is only available in Premium tier (say sending a message greater than 256KB in size) and catch the exception (or lack of) to determine if the Service Bus tier is Premium or not. 某种反模式,但是您可以做的一件事就是执行和操作仅在Premium层中可用(例如,发送大于256KB的消息),并捕获异常(或缺少)以确定服务总线层是否是否高级。

If we want to check the Azure Service Bus Pricing tier,we could use the following code with Microsoft.Azure.Management.Fluent SDK. 如果要检查Azure服务总线定价层,可以将以下代码与Microsoft.Azure.Management.Fluent SDK结合使用。

 var credentials = SdkContext.AzureCredentialsFactory.FromFile(@"c:\tom\azureCredential.txt");
 var azure = Azure
            .Configure()
            .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
            .Authenticate(credentials)
            .WithDefaultSubscription();

 var serviceBus =  azure.ServiceBusNamespaces.GetByResourceGroup("resourcegroup", "servicebusnamespace");
 var priceTier = serviceBus.Sku.Tier;

在此处输入图片说明

Before code we need to create an azure active directory application and assign the correspondent role . 在编写代码之前,我们需要创建一个Azure活动目录应用程序并分配相应的角色 We could create the azure credential file following the document . 我们可以在文档之后创建azure凭证文件。 The following is the credential file format. 以下是凭证文件格式。

subscription=########-####-####-####-############
client=########-####-####-####-############
tenant=########-####-####-####-############
key=XXXXXXXXXXXXXXXX
managementURI=https\://management.core.windows.net/
baseURL=https\://management.azure.com/
authURL=https\://login.windows.net/
graphURL=https\://graph.windows.net/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为Azure Service Bus Premium使用灾难恢复功能 - How to use disaster recovery feature for Azure Service Bus Premium Azure 服务总线高级命名空间成本 - Azure service bus premium namespace cost 如何检查 Azure 服务总线队列是否为空? - How to check the Azure Service Bus queue is empty? 在Azure Service Bus Premium层中,一个MU每月可以处理多少个操作? - In Azure Service Bus Premium tier, how many operations per month can 1 MU handle? Azure Service Bus Premium-地理恢复-丢弃的消息 - Azure Service Bus Premium - Geo-Recovery - dropped messages Azure 服务总线:消息大小、技术限制和定价 - Azure Service Bus: Message size, technology limit and pricing Azure 事件中心 高级定价 model - Azure Event Hubs Premium pricing model 将多个 Azure 函数部署到同一个应用服务计划的定价(弹性高级计划 - EP1) - Pricing for deploying multiple Azure Functions to the same App Service Plan (Elastic Premium Plan - EP1) 如何检查 Azure 服务总线主题中存在的特定记录 - How to check specific record exist in azure service bus topic Azure 服务总线:如何正确检查订阅是否已存在? - Azure Service Bus: How to correctly check if Subscription already exists?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM