我有一个 Azure ServerLess C# 项目,我将它部署到 azure 中,其中包含 2 个函数,这两个函数都应该由它们相应的队列触发。我注意到只触发了第一个函数,而没有注意到第二个函数。我所有的设置都是正确的,但我注意到如果我对最顶部的函数重新排序是唯一会被触发的函数。是否有一些我必须编辑的文件,我已经编辑说有 2 个触发功能。
这是主要的 .CS 文件
[StorageAccount("AzureWebJobsStorage")]
public class QueueFunction
{
ICollaborationClient _collaborationClient;
ILogger<QueueFunction> _logger;
public QueueFunction(ICollaborationClient collaborationClient, ILogger<QueueFunction> logger)
{
_collaborationClient = collaborationClient;
_logger = logger;
}
[FunctionName("ParticipantQueueFunction")]
public async Task Run([QueueTrigger("%ParticipantQueueName%")] ParticipantNotificationModel participantNotificationModel, ILogger log)
{
log.LogInformation(JsonConvert.SerializeObject(participantNotificationModel, Formatting.Indented));
await _collaborationClient.PostAsync("/api/ParticipantHub", participantNotificationModel, participantNotificationModel.Headers);
log.LogInformation($"function processed participant id: {participantNotificationModel.ParticipantServiceModel.ParticipantId}");
}
[FunctionName("MessageQueueFunction")]
public async Task Run([QueueTrigger("%MessageQueueName%")] MessageNotificationModel messageNotificationModel
, ILogger log)
{
log.LogInformation(JsonConvert.SerializeObject(messageNotificationModel, Formatting.Indented));
await _collaborationClient.PostAsync("/api/notifications/SendNotifications", messageNotificationModel.MessageServiceModel, messageNotificationModel.Headers);
log.LogInformation($"function processed message id: {messageNotificationModel.MessageServiceModel.MessageId}");
}
}