如何使 Azure 函数与现有服务总线主题触发器一起使用?

How can I make Azure functions work with an existing Service Bus Topic trigger?

已阅读文档,但仍不清楚其工作原理。我有以下 function.json:

{
  "bindings": [
    {
      "type": "serviceBusTrigger",
      "name": "message",
      "direction": "in",
      "subscriptionName": "notifications",
      "topicName": "order-placed",
      "connection": "orders",
      "accessRights": "Manage"
    }
  ],
  "disabled": false
}

根据文档,上面的连接字符串是正确的。订阅 "notifications" 不存在 - 这是由 Azure 函数创建的,还是我必须使用其他机制为该主题创建订阅?当我向针对该主题的总线发送消息时,我的函数不会被调用。没有订阅,没有错误,也没有日志。我尝试手动创建订阅,但没有成功。我错过了什么?

这里是sample ServiceBusTopicTrigger on github, and here is the documentation for the ServiceBusTrigger.

确保 orders 是您应用的应用设置,具有有效的管理连接字符串。

如果您的函数应用有多个服务总线连接,请检查以确保您在门户中使用正确的连接。

如果您提供具有管理权限的连接字符串(在门户中您应该看到管理、发送、收听)我们将 automatically create the topic and subscription for you

此外,在您的存储帐户或 kudu scm 站点中检查您的应用程序的主机日志 <yourapp>.scm.azurewebsites.net/debugconsole -> LogFiles\Application\Functions\Host