gpt4 book ai didi

python - 基于ServiceBus触发Azure Function并写回不起作用(Python)

转载 作者:行者123 更新时间:2023-12-03 02:22:58 27 4
gpt4 key购买 nike

我有一个 Python Azure 函数,该函数根据发送到主题的消息触发,该函数独立运行良好。但是,如果我随后尝试将消息写入不同的 ServiceBus 队列,则它将不起作用(因为在 Azure 函数中,如果将新消息发布到该主题,甚至不会触发)。当我包含 msg_out: func.Out[str] 组件时,感觉触发条件不满足。任何帮助将不胜感激!

__init.py

import logging
import azure.functions as func

def main(msg: func.ServiceBusMessage, msg_out: func.Out[str]):
# Log the Service Bus Message as plaintext

# logging.info("Python ServiceBus topic trigger processed message.")
logging.info("Changes are coming through!")

msg_out.set("Send an email")

function.json

{
"scriptFile": "__init__.py",
"entryPoint": "main",
"bindings": [
{
"name": "msg",
"type": "serviceBusTrigger",
"direction": "in",
"topicName": "publish-email",
"subscriptionName": "validation-sub",
"connection": "Test_SERVICEBUS"
},
{
"type": "serviceBus",
"direction": "out",
"connection": "Test_SERVICEBUS",
"name": "msg_out",
"queueName": "email-test"
}
]
}

host.json

{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
},
"extensions": {
"serviceBus": {
"prefetchCount": 100,
"messageHandlerOptions": {
"autoComplete": true,
"maxConcurrentCalls": 32,
"maxAutoRenewDuration": "00:05:00"
},
"sessionHandlerOptions": {
"autoComplete": false,
"messageWaitTimeout": "00:00:30",
"maxAutoRenewDuration": "00:55:00",
"maxConcurrentSessions": 16
}
}
}
}

最佳答案

我可以重现您的问题,它似乎是由以下错误引起的:

Property sessionHandlerOptions is not allowed.

enter image description here

删除sessionHandlerOptions可以正常触发。

关于python - 基于ServiceBus触发Azure Function并写回不起作用(Python),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68146273/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com