【问题标题】:queueTrigger function not firingqueueTrigger 函数未触发
【发布时间】:2021-05-15 16:58:46
【问题描述】:

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

【问题讨论】:

    标签: c# azure-functions message-queue queuetrigger


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2014-12-12
      • 1970-01-01
      • 1970-01-01
      • 2021-06-15
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多