javascript - Azure Functions bundle 和扩展、函数版本 - javascript 混淆 2.x、5.0.x+?

标签 javascript azure azure-functions

我正在使用 Nodejs 制作一个由服务总线主题触发的 azure 云函数。

读到这里我非常困惑,他们对所有内容都有一个版本,但他们的文档中没有任何意义。

https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=in-process%2Cazure-cli%2Cv4&pivots=programming-language-javascript

host.json 文件有 2 个版本:架构版本和捆绑范围版本。然后文章讨论了 5.x+ 版本,但默认范围是 3.3.0 到 4.0,但不包括 4。我很困惑我使用的是什么版本,我可以使用哪些绑定(bind)选项,并且没有一篇文章解释任何内容清晰简洁的方式。

{
    "version": "2.0",
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[3.3.0, 4.0.0)"
    }
}

这是否包括他们谈论的 5.x+ here ?我需要制作这个 5.0.0 吗?

如果我使用上面的主机,这个host.json配置会失效吗?上面的链接没有将 messageHandlerOptions 显示为选项之一(对于 5.0.x),但提到如果不使用 session 也可以。它只适用于 2.0.x 吗?

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.3.0, 4.0.0)"
  },
  "extensions": {
    "serviceBus": {
      "prefetchCount": 1,
      "messageHandlerOptions": {
        "autoComplete": true,
        "maxConcurrentCalls": 1,
        "maxAutoRenewDuration": "00:09:30"
      }
    }
  },
  "functionTimeout": "00:09:55"
}

功能和扩展有什么区别? enter image description here

最佳答案

我相信我的回答(如下)可以解决您的困惑:

enter image description here

Then the article talks about 5.x+ version, but the default range is 3.3.0 to 4.0 but not including 4. I am very confused what version am I using, what binding options are available to me

我认为,他们已经明确/说明了在 C# 编程语言中使用哪个 host.json 版本,但在同一文档中的其他语言中却错过了该信息。

如果您通过在一定程度上最小化文档来仔细查看,那么这将提供扩展版本的清晰度:

enter image description here

说明:

如果您使用此扩展的 5.x 或更高版本 Microsoft.Azure.WebJobs.Extensions.ServiceBus,则可以使用 扩展 5.x+ 中提供的新配置设置host.json 文件中。

如果您使用此扩展的 <5.x 版本 Microsoft.Azure.WebJobs.Extensions.ServiceBus,则可以使用 Function 2.x+ 中提供的可配置设置> 在 host.json 文件中。

<小时/>

What is the difference between Function and Extension?

据我所知,他们将版本名称重命名为Function 1.x、2.x、Extension 5.x,这些都是稳定版本。

<小时/>

If I use the host above, does this host.json config become invalid? The link above does not show messageHandlerOptions as one of the options (for 5.0.x) but mentions it being ok if not using sessions. Does it only apply for 2.0.x?

根据我的理解 - 在文档中,每个版本都有可用的新配置设置,但 messageHandlerOptionsFunction 2.x 中都可用Azure Functions 服务总线触发器绑定(bind)中 host.json 文件的 >Extension 5.x 版本。

enter image description here

更新的答案:

MSFT Doc您在评论中提供的内容提供了有关 Azure Functions 运行时版本(例如 1.x、2.x、3.x 和 4.x)的详细信息。

这些是运行特定语言运行时程序所需的 Azure Functions 核心工具版本。

例如:

JavaScript 版本(NodeJS 10、12 和 14)适用于 Azure Functions 版本 3.x,而 NodeJS 版本 16 适用于 Azure Functions 版本 4.x >.

本文档还介绍了 Azure Functions Runtime/Core Tools 版本从旧版本到新版本的迁移步骤和重大更改。

Do I change the range in host.json to 5?

host.json 的每个版本,即 Functions 1.xFunctions 2.xExtension 5.x 是相同的,他们在每个新版本中增加/发现了新的可配置设置。

I still don't understand the difference between function version and extension version. What version am I running?

请参阅同一答案中的解释段落。

在简单中,如果您使用的扩展 Microsoft.Azure.WebJobs.Extensions.ServiceBus 版本等于 5.x 或更高版本,则可以使用 中提供的设置>扩展 5.x+ block 。如果该 ServiceBus 扩展版本低于 5.x,则使用 Functions 2.x 中为 host.json 文件提供的配置设置.

关于javascript - Azure Functions bundle 和扩展、函数版本 - javascript 混淆 2.x、5.0.x+?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72243355/

相关文章:

javascript - 高级 slider 定制

c# - Azure Function Blob 触发器将文件复制到文件共享

azure-functions - Azure 函数部署失败,Azure Pipeline 中的 Azure CLI 2.2.0 更新

javascript 表单提交重定向

javascript - 任何使用 Moment.js 解析时间字符串但忽略时区信息的方法?

javascript - 多个范围类型的 HTML 输入标签总是加起来为特定值?

c# - 如何从 azure 数据库填充 ListView

azure - 无法删除 Azure 中的自定义域

json - 如何将 az cli 的输出保存到本地数据库?

azure - 当 blob 更改时触发 Azure databricks