我有一个Azure队列和一个队列触发器,如下所示:
[FunctionName("NewCustomerQT")]
public static void Run([QueueTrigger("testqueue", Connection = "AzureWebJobsStorage")]CustomerDescription newCustomer, ILogger log)
{
log.LogInformation($"C# Queue trigger function processed: {newCustomer}");
HandleIncomingMessage handleIncomingMessage = new HandleIncomingMessage();
handleIncomingMessage.HandleEvent(newCustomer);
}
这反过来应该触发HandleIncomingMessage的HandleEvent:
public class HandleIncomingMessage
{
public void HandleEvent(CustomerDescription myQueueItem)
{
CustomerInformationHandler.GetConfigurationId(myQueueItem.personalId);
}
}
但是,HandleEvent方法根本不运行。我可以确认队列触发器已运行并且队列中的消息正在使用。
如果我用一些打印行替换CustomerInformationHandler.GetConfigurationId(myQueueItem.personalId);
,则HandleEvent在队列触发器中运行得很好。如果我从Main手动运行CustomerInformationHandler.GetConfigurationId(myQueueItem.personalId);
,它也应能正常工作。那么,为什么我的队列触发器在检测到传入消息时不能运行此功能?