标签: azure-servicebus-topics

在本地使用Azure Service Bus

我正在使用Azure Service Bus主题和订阅.它用于在整个应用程序中发送控制消息.消息侦听器(订阅者)以worker角色运行,他们正在拾取消息并处理请求.即使有多个侦听器同时运行,总线中的每条消息也只能被拾取一次.

使用服务总线没有问题; 但是,我们在本地调试/测试应用程序时遇到了一些问题.我们有2个服务总线,一个用于云,一个用于本地调试.现在,如果多个人同时调试应用程序,则只有一个系统(随机)选择该消息.这是预期的行为,但它在调试时会造成麻烦.

有什么办法可以将本地仿真器用于服务总线吗?我做了一些研究,但我找不到任何可靠的解决方案.我们如何单独调试应用程序?

azure azureservicebus brokeredmessage azure-servicebus-topics

11
推荐指数
2
解决办法
4615
查看次数

Azure 服务总线:为无法处理的消息实施指数重试策略的最佳方式

我不断地以窥视模式接收消息,如果处理失败(不是传递),我会放弃它们。但是,该消息会立即再次变得可用并被再次接收以进行处理。它再次快速失败,并且在最大交付量之后它是死信的。

有没有办法配置主题/订阅在消息被放弃后在发布之前等待?优选以指数方式。

当然,我也愿意通过代码提出建议。

service azure bus azureservicebus azure-servicebus-topics

9
推荐指数
1
解决办法
3241
查看次数

具有带有多个订阅的主题的Service Bus的Azure ARM模板

嗨,我有一个用于创建带有主题和订阅的ServiceBus的ARM模板。但是我只能完成1个主题-1个订阅,因为我无法进行嵌套循环来为每个主题创建多个订阅。

我希望我可以执行这样的模板:

参数:

{
   "serviceBusName": "mybus",
   "topics": 
    [ 
      { 
         "topicName": "mytopic1",
         "subscriptions": [ "mysubscription1", "mysubscription2"]
      },
      { 
         "topicName": "mytopic2",
         "subscriptions": [ "mysubscription1"]
      }  
    ]
}
Run Code Online (Sandbox Code Playgroud)

这是我的实际模板:

{
  "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "ServiceBusNamespaceName": {
      "type": "string"
    },
    "ServiceBusSku": {
      "type": "string",
      "allowedValues": [
        "Basic",
        "Standard"
      ],
      "defaultValue": "Standard"
    },
    "ServiceBusSmallSizeTopicInMb": {
      "type": "int",
      "defaultValue": 1024
    },
    "ServiceBusMaxSizeTopicInMb": {
      "type": "int",
      "defaultValue": 1024
    },
    "Topics": {
      "type": "array"
    }
  },
  "variables": {
    "DefaultSASKeyName": "RootManageSharedAccessKey",
    "DefaultAuthRuleResourceId": "[resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', parameters('ServiceBusNamespaceName'), variables('DefaultSASKeyName'))]",
    "SbVersion": "2017-04-01" …
Run Code Online (Sandbox Code Playgroud)

servicebus azure azureservicebus azure-resource-manager azure-servicebus-topics

9
推荐指数
1
解决办法
186
查看次数

Azure 服务总线 - 未经授权的访问。执行此操作需要“发送”声明

Azure Service Bus Queue我正在尝试从我的应用程序访问Windows Service。我正在关注这个样本。

我想Azure Service Bus使用Azure Service Principal 下面是我已实施的步骤来保护它

  1. 注册一个名为pc-shutdown-producer代表Azure Ad 我的应用程序Windows Service
  2. 我创建了我的 Azure,service bus namespace名为shutdowncomputer
  3. 在里面Access control (IAM),我添加了Role Assignment以下值
    • 角色 -Azure Service Bus Data Owner
    • 分配访问权限 -pc-shutdown-producer

据我所知,上述配置将让pc-shutdown-producer应用程序管理 servicebus 命名空间中的所有资源。4. 除此之外,我还提供了pc-shutdown-producer访问服务总线命名空间的委托 API 权限。

在此输入图像描述

下面是我的 C# 代码。

        public async Task Init()
        {
            string authority = $"https://login.windows.net/{TenantId}";

            ITokenProvider tokenProvider = TokenProvider.CreateAzureActiveDirectoryTokenProvider(AuthenticationCallback, authority);
            var …
Run Code Online (Sandbox Code Playgroud)

servicebus azureservicebus azure-servicebus-queues azure-servicebus-topics azure-rbac

9
推荐指数
1
解决办法
2万
查看次数

Azure Service Bus消息泵是否真的是事件驱动的?

所以我们最近一直在研究Azure Service Bus,我们对是否应该使用无限循环轮询队列/订阅或者是否应该使用OnMessage回调/消息泵功能感到困惑.什么会执行更少的操作,从而降低成本?

理想情况下,我们需要一个事件驱动的系统,因此我们不会浪费操作,而且通常只是一种更好的方法.

我的问题是,使用OnMessage定义为"在事件驱动的消息泵中处理消息"真的是事件驱动的吗?

如果你看看这个页面(QueueClient.OnMessage):https://msdn.microsoft.com/library/azure/microsoft.servicebus.messaging.queueclient.onmessage.aspx 你会注意到底部的评论它基本上是一个无限循环的包装器,它调用Receive()方法.这对我来说听起来不是事件驱动的.

现在,如果您查看此页面(SubscriptionClient.OnMessage):https: //msdn.microsoft.com/en-us/library/azure/dn130336.aspx,该注释不存在.那么主题/订阅和队列是一样的,还是它实际上是订阅的事件驱动而不是队列?

为什么他们甚至说这是事件驱动的,显然不是?QueueClient.OnMessage页面上的注释具有"无限循环"和"每个接收操作是可计费事件"这一事实有点可怕.

另外,我并不是真的担心它会花多少钱/多少钱,我更感兴趣的是让它尽可能高效.

c# servicebus azure azureservicebus azure-servicebus-topics

8
推荐指数
1
解决办法
1039
查看次数

qpid proton url用于接收来自给定订阅(主题)的消息

我想阅读服务总线的订阅消息.我正在使用qpid-protonpython库.我正在关注此链接以接收消息Proton-Python-Example-Simple-Receive.我正在通过此网址接收来自服务总线的消息 -

url = 'amqps://mynamespace.servicebus.windows.net/SharedAccessKeyName=xxxx/SharedAccessKey=xxxxxxxxx/python-test/Subscriptions/AllMessages'
# python-test is the name of the topic
# AllMessages is the name of the subscription
Run Code Online (Sandbox Code Playgroud)

我收到以下错误 - ERROR:root:The messaging entity 'sb://mynamespace.servicebus.windows.net/sharedaccesskeyname=xxxxx/sharedaccesskey=xxxxxxxxxxxxx/python-test/subscriptions/allmessages' could not be found. TrackingId:c1e4a39edbd44040b2fd48a552d6ae2b_G2, SystemTracker:gateway6, Timestamp:7/19/2017 7:58:51 AM

这是因为上述URL未正确形成.我在网上搜索过,在这方面没有提供适当的文件.通过qpid读取订阅消息的正确URL格式是什么.

python qpid azureservicebus azure-servicebus-queues azure-servicebus-topics

8
推荐指数
1
解决办法
348
查看次数

如何在本地调试 ServiceBus 触发的 Azure 函数?

我的函数将从现有的 ServiceBus 主题触发。我已经使用 VS2017 (15.3) 预览版中的新工具创建了该函数,作为编译函数。

如何在本地测试此功能?

azure azureservicebus azure-servicebus-topics azure-functions

8
推荐指数
2
解决办法
7794
查看次数

Azure ServiceBusConnectionStringBuilder 中的“entityPath”是什么?

我想使用 ServiceBusConnectionStringBuilder 连接到 Azure 服务总线。

当我将 Azure 上生成的连接字符串输入到带有一个参数的构造函数时

public ServiceBusConnectionStringBuilder (string connectionString);

实体路径为空。当我想使用 4 参数构造函数创建连接字符串时

public ServiceBusConnectionStringBuilder (string endpoint, string entityPath, string sharedAccessKeyName, string sharedAccessKey);

当我输入entityPath null 或空字符串时,会引发异常。Visual Studio 调试器显示两个连接字符串生成器的值相同。

我应该在entityPath中输入什么才能正确执行构建器?

我不知道,因为这个对象的文档丢失了。这里是文档页面SerbiceBusConnectionStringBuilder 文档的链接

c# azure azure-servicebus-topics

8
推荐指数
1
解决办法
7863
查看次数

持续接收来自Azure ServiceBus的消息

根据此处的Azure ServiceBus 文档:

ServiceBusReceiver 类定义用于从 Azure 服务总线队列或主题订阅接收消息的高级接口。消息接收的两个主要通道是 receive(),用于发出单个消息请求,以及async for message in receiver:以持续的方式连续接收传入消息。

我一直在尝试使用async for message in receiver:建议在每次出现消息时触发函数,但我不确定如何正确执行,因为我几乎没有使用异步函数的经验。熟悉异步/服务总线的人可以解释一下代码应该如何格式化吗?

编辑:让我提供更多背景信息。我正在创建一个 python Flask 服务,在启动时,我需要它开始监听主题/订阅名称上的消息。每当它收到消息时,它都会执行一些代码,然后发回消息。那么...如何在启动时启动异步侦听器,并让它在触发时执行一些代码?它还应该能够以非阻塞的方式处理每条消息。因此,如果同时收到两条消息,则应同时处理两条消息。

注意:我无法使用 Azure Functions。

python asynchronous azure azureservicebus azure-servicebus-topics

7
推荐指数
1
解决办法
3724
查看次数

Azure 函数服务总线主题触发器休眠

我正在研究服务总线主题触发功能。我们已经使用了消费计划。据观察,该函数在不活动后进入睡眠状态,并且当有关于主题的新消息时它不会唤醒。

功能是使用arm模板使用管道部署的,部署后我们不会进行任何更改。

同一问题在多次讨论中得到讨论。

https://github.com/Azure/Azure-Functions/issues/229

可能的解决方案位于以下位置。 https://github.com/Azure/Azure-Functions/issues/210

但不确定这里作为开发人员需要做什么。有人可以帮忙吗?

azureservicebus .net-core azure-servicebus-topics azure-functions

7
推荐指数
0
解决办法
625
查看次数