У меня есть роль рабочего Azure, которая отвечает за проверку 4 очередей служебных шин. В настоящее время я просто метод цикла, чтобы вручную проверять очереди.
while(true)
{
//loop through my queues to check for messages
}
С Azure SDK 2.0 появилась возможность слушать сообщения, а не опросы для них. Но каждый пример, который я видел, использует консольное приложение с Console.ReadKey(). Есть ли способ заставить рабочую роль сидеть и ждать сообщений?
Я пробовал:
public override void Run()
{
_queueProcessors.ForEach(x => x.OnMessage(Process);
}
где _queueProcessors - это список QueueClients, а Process - частный метод обработки сообщений. Однако рабочая роль будет регистрировать их, а затем перезагружать.
Итак, кто-нибудь знает, как заставить клиента очереди сидеть и ждать сообщения?