我有一个Azure ServerLess C#项目,我把它部署到了azure上,它有两个功能,这两个功能都应该由它们对应的队列触发。我只注意到了第一个函数的触发,而没有注意到第二个。我的所有设置都是正确的,但我注意到,如果我重新排序了顶部的函数,那么最多的函数是唯一将被触发的函数。有没有一些我必须编辑的文件,我已经编辑过了,说有两个触发器函数。
下面是主.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}");
}
}发布于 2021-02-12 06:00:33
我发现了我的问题,这两种方法的名称是相同的。我刚刚重读了我的问题。
https://stackoverflow.com/questions/66163435
复制相似问题