c# - 如何向连续的 Azure WebJob 通知队列上的新消息?

标签 c# azure azure-webjobs azure-sdk-.net azure-queues

连续的 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/

相关文章:

c# - 无法从 "method group"转换为 "string"

c# - Crystal Reports - 关于要求和的记录的公式字段条件语句

azure - 未找到 Linux Azure WebApp 的指定框架 'Microsoft.AspNetCore.App' 、版本 '3.1.0'

asp.net-core - 如何将 .net core WebJob 与 asp.net core web app 一起发布?

azure-web-app-service - Azure Webjob TextWriter 记录器在我的方法中间处理

c# - 来自默认 ASP.NET MVC 新项目的异步操作的解释?

c# - 如何根据最高 IDENTITY 条目提取 SQL 表条目并更新两列

azure - 要在门户中查看 Azure Function,至少需要什么角色?

azure - 将 Azure 应用服务的连接限制为一个 IP 地址

c# - Azure 函数 : Value cannot be null. 参数名称:source