c# - 为什么我的 Azure 函数在消耗计划上运行时没有扩展?
问题描述
我有一个连接到服务总线队列的 Azure 函数。它接收消息并生成记录以保存在 Azure 表存储中。
Service Bus 队列当前有很多消息:
由于有很多待处理的消息,我希望 Azure Functions 的扩展会发生,但似乎并非如此:
只有一个函数实例正在运行,我希望有更多实例可以帮助清空队列。
正如Azure Function 的关于使用服务总线时进行缩放的文档中所指定的那样,我确保 Azure Function 使用的策略包括帮助缩放的管理权限:
问题
为什么我的 Azure 函数在消耗计划上运行时无法扩展以帮助将所有消息从服务总线中取出?
更新
这是 Azure 函数的摘录:
public static class RecordImporter
{
private static readonly IImporter Importer;
static RecordImporter()
{
Importer = new AzureTableImporter();
}
[FunctionName("Importer")]
public static async Task Run([ServiceBusTrigger("records ", Connection = "serviceBusConnectionString")] string serializedRecords, ILogger log)
{
var records = JsonConvert.DeserializeObject<List<Record>>(serializedRecords);
await Importer.AddRecordsAsync(records);
}
}
解决方案
只是一个想法,因为有些人面临服务总线触发器扩展的类似问题:
https://github.com/microsoft/azure-pipelines-tasks/issues/6759
我注意到您使用的是 C#,因此请在发布时执行此操作:
(清除从包文件中运行复选框。VS默认使用Zip部署,通过上述步骤可以更改为Web部署。)
推荐阅读
- python - Python re.match 仅在第一个 \n 之前匹配
- google-apps-script - “需要授权才能执行该操作”用于警报/弹出窗口,电子表格的 Google Apps 脚本插件
- javascript - Ajax 响应没有响应 json 响应
- android - 无法使用 Android 中的侦听器在 HistoryClient 中侦听 BP、温度和血糖的更新
- mysql - 不满足条件时,SELECT 语句应返回 0
- django - 类型错误:t.map 不是函数 - react-dom.production.min.js:4483
- opencv - 如何使用 OpenCV 获取相机焦距
- angular - 打字稿数组操作/展平
- python - python 中的 torch.matmul 计算不准确
- date - 更改字符串中日期的格式