您可以使用 SubscriptionClient/QueueClient 的 .OnMessage
调用订阅来自 Azure 主题和队列的异步更新,这可能会创建一个单独的线程,使用默认设置轮询主题/队列,并在以下情况下调用定义的回调:它接收任何东西。
Azure网站称接收消息是一项计费操作,这是可以理解的。但是,即使这些轮询请求没有返回任何内容(即相关队列没有待处理的消息),是否仍将其视为可计费,这一点还不够明确。
最佳答案
基于Azure Service Bus Pricing FAQ - 你的问题的答案是肯定的
In general, management operations and “control messages,” such as completes and deferrals, are not counted as billable messages. There are two exceptions:
Null messages delivered by the Service Bus in response to requests against an empty queue, subscription, or message buffer, are also billable. Thus, applications that poll against Service Bus entities will effectively be charged one message per poll.
Setting and getting state on a MessageSession will also result in billable messages, using the same message size-based calculation described above.
鉴于价格为每 10,000 条消息 0.01 美元,我认为您不必对此过于担心。
关于azure - Azure 客户端 .OnMessage 是否为空队列生成计费请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21687656/