[英]get Azure Service Bus Queue active message count by SessionId using C#
I want to get the count of the messages from an Azure Service Bus Queue, using the SessionId of the messages.我想使用消息的 SessionId 从 Azure 服务总线队列中获取消息计数。
I found how to count them without filtering by Session IDs here - Get queue message count using Microsoft.Azure.Management.ServiceBus , but I really need to count the messages with a specific SessionId.我在这里找到了如何在不按 Session ID 过滤的情况下对它们进行计数 - 使用 Microsoft.Azure.Management.ServiceBus 获取队列消息计数,但我确实需要使用特定的 SessionId 对消息进行计数。
You can get the count of the messages from an Azure Service Bus Queue as said, but by using the particular SessionId you cannot get the messages count.如前所述,您可以从 Azure 服务总线队列中获取消息计数,但是通过使用特定的SessionId ,您无法获取消息计数。
The Azure.Messaging.ServiceBus. Azure.Messaging.ServiceBus。 ServiceBusSessionReceiver is responsible for receiving ServiceBusReceivedMessage and settling messages from session-enabled Queues and Subscriptions. ServiceBusSessionReceiver负责从启用会话的队列和订阅中接收ServiceBusReceivedMessage和结算消息。
public class ServiceBusSessionReceiver :
Azure.Messaging.ServiceBus.ServiceBusReceiver
By using the default Properties of this class, we can get the details of SessionId and others like PrefetchCount, IsClosed etc..通过使用这个 class 的默认属性,我们可以获得SessionId和其他信息,如 PrefetchCount、IsClosed 等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.