【发布时间】:2021-12-17 04:36:07
【问题描述】:
当我构建 Azure Function (Java) 的以下代码时,生成的 function.json 中没有设置 isSessionsEnabled。
如何在function.json中设置isSessionsEnabled = true?
构建使用 Gradle。
public class Function {
@FunctionName("FunctionApp")
public void run(
@ServiceBusQueueTrigger(
name = "TriggerName",
queueName = "queueName",
connection = "ConnectionString",
isSessionsEnabled = true
) String message,
ExecutionContext context
) {
}
}
- fucntion.json
{
"scriptFile" : "../func.jar",
"entryPoint" : "test.Function.run",
"bindings" : [ {
"type" : "serviceBusTrigger",
"direction" : "in",
"name" : "message",
"queueName" : "queueName",
"connection" : "ConnectionString"
} ]
}
【问题讨论】:
-
很遗憾,通过设置来定义 IsSessionEnabled 是不可行的。队列名称可以通过在定义 ServiceBusQueueAttribute 时使用 % 符号在设置文件中定义,如 here 所示,虽然该示例适用于 C#,但它也适用于 Java。
标签: java azure azure-functions