queueTrigger 函数未触发

问题描述

我有一个 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}");
    }
}

解决方法

我发现了我的问题,这两种方法的名称相同。我刚刚重读了我的问题。