连续的 Web 作业正在运行,处理队列中的消息(正常优先级)。但是,如果另一个队列(高优先级)有任何消息,它希望收到通知,然后切换到处理该队列中的消息,直到空为止,然后恢复到原始队列。
如何实现这一目标?我不想在处理每条消息之前手动检查高优先级队列,因为这将花费 IO 操作(收费)。 据我所知,网络作业无法直接相互通信 - 因此使用另一个具有队列触发器的网络作业我认为不会起作用(如果不正确,请告诉我)。
最佳答案
Ritchie,您应该考虑使用 Azure 服务总线,然后使用优先级队列。有一篇很棒的文章详细介绍了如何在这个blog post中进行操作。 马克使用了两种技术:
a very simple way to achieve priority queues is to have two (or more) queues. One queue is for high priority messages, and the other for low priority. Whenever you send a message, you pick which queue to send it to. So this technique assumes that the code sending the message knows whether it should be high priority or not, and also knows how many priority queues there are.
第二种技术是:
An alternative approach is to make use of Azure Service Bus topics and subscriptions. With this approach, the messages are all sent to the same topic. But a piece of metadata is included with the message that can be used to partition the messages into high and low priorities.
关于c# - 如何向连续的 Azure WebJob 通知队列上的新消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49393958/