【发布时间】: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