【问题标题】:Azure function app not triggering from an Event HubAzure 函数应用未从事件中心触发
【发布时间】:2022-10-06 17:47:11
【问题描述】:

我有一个订阅 A 中的事件中心和订阅 B 中的一个函数应用程序,我正在尝试从订阅 A 中的事件中心触发函数应用程序,根据我的研究,这应该是可能的,并且必须提供正确的连接字符串在功能应用程序的配置中。我已经这样做了,但由于某种原因我无法触发函数应用程序。

下面是我的function.json

{
  \"scriptFile\": \"__init__.py\",
  \"bindings\": [
    {
      \"type\": \"eventHubTrigger\",
      \"name\": \"event\",
      \"direction\": \"in\",
      \"eventHubName\": \"%eventHubName%\",
      \"connection\": \"TestBench\",
      \"cardinality\": \"one\",
      \"consumerGroup\": \"$Default\"
    },
    {
      \"type\": \"eventHub\",
      \"name\": \"outputHub\",
      \"direction\": \"out\",
      \"connection\": \"outputConnection\"
    }
  

我已经仔细检查了 \"TestBench\" (eventhubs) 连接字符串以及 eventhub\ 的名称,它们是正确的。

以下是我在 __init__.py 中的函数应用代码:

def main(event: func.EventHubEvent, outputHub: func.Out[List[str]]):
    
    data=json.loads(event.get_body().decode(\'utf-8\'))
    logging.info(data)

    标签: python azure triggers azure-functions azure-eventhub


    【解决方案1】:

    请验证您是否在函数应用的应用程序设置中配置了 eventHubName 属性,因为您已将绑定定义为 "eventHubName": "%eventHubName%"

    如果这是正确的,那么请验证连接字符串是否配置正确。

    我建议您查看函数应用程序上的 Diagnostic and solve problem 刀片,这将帮助您诊断问题并推荐解决问题的解决方案。

    请查看 python 示例here 并在最后进行测试。

    【讨论】:

      猜你喜欢
      • 2017-10-07
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 2023-02-01
      • 2021-11-27
      • 1970-01-01
      • 2022-09-26
      相关资源
      最近更新 更多