简体   繁体   English

使用 C# 通过 SessionId 获取 Azure 服务总线队列活动消息计数

[英]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.

相关问题 无法使用托管身份将消息从 Azure API 发布到 Azure 服务总线队列 - Unable to post message to Azure Service Bus Queue from Azure API using Managed Identity 使用Azure服务总线发送消息到Salesforce - Using Azure service bus to send message to Salesforce 无法为 Azure 服务总线队列设置 maxMessageBatchSize - Not able to set maxMessageBatchSize for Azure Service Bus Queue Azure服务总线中是否存在Poison Queue? - Does Poison Queue exists in Azure Service Bus? 控制 Azure Service Bus Message Listener 在 spring 开机启动或停止监听 Topic 或队列 - Control Azure Service Bus Message Listener to start or stop listening from the Topic or queue in spring boot Azure 服务总线队列自动删除,如 RabbitMQ - Azure Service Bus queue autodelete like in RabbitMQ 清除 azure 服务总线队列 go - Clearing azure service bus queue in one go 类型错误:为“消息”提供的值必须是类型:服务总线队列中的 ServiceBusMessage Azure - TypeError: Provided value for 'message' must be of type: ServiceBusMessage in a Service Bus Queue Azure 逻辑应用中的 Azure 服务总线队列错误 - Azure service bus queue error in the logic app .net 5 Azure 总线服务队列监听器 - .net 5 Azure Bus Service Queue Listener
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM