简体   繁体   English

Azure 服务总线 | 重新处理死信消息返回队列 | 如何接收来自死信队列的所有消息?

[英]Azure service bus | Re process dead letter messages back to queue | How to receive all messages from dead letter queue?

I want to integrate the processing of messages back to Queue using a Unique Identifier as user inputs.我想使用唯一标识符作为用户输入将消息处理集成回队列。 How to fetch all the messages from the dead letter in a single call instead of looping it multiple times?如何在一次调用中从死信中获取所有消息,而不是多次循环?

        var msRequestIdArg = MsRequestIds.Split('\n').Select(e => e.Trim()).ToList();
        var msRootRequestArg = MsRootRequestIds.Split('\n').Select(e => e.Trim()).ToList();
        var queueClient = QueueClient.CreateFromConnectionString(ServiceBusConnectionString, QueueName);
        var factory = MessagingFactory.CreateFromConnectionString(ServiceBusConnectionString);
        var deadLetterPath = QueueClient.FormatDeadLetterPath(QueueName);
        var deadLetterQueueReceiver = factory.CreateMessageReceiver(deadLetterPath, ReceiveMode.PeekLock);
        deadLetterQueueReceiver.PrefetchCount = 10;
        var messageResponse = new List<Tuple<string, bool, string>>();
        var counter = msRequestIdArg.Count + msRootRequestArg.Count;

        while (counter > 0)
        {
            var brokeredMessage = await deadLetterQueueReceiver.ReceiveAsync().ConfigureAwait(false);

Short answer: you can't and should not.简短的回答:你不能也不应该。

Imagine you'd have hundreds of thousands, if not millions, of messages that need to be returned.想象一下,您将有数十万甚至数百万条消息需要返回。 Can you imagine the constraints on both the broker and the clients with this amount of messages that need to be transferred?您能想象对于需要传输这么多消息的代理和客户端的限制吗? Failures are expected to happen, and with a very large number of messages, you'd be quickly finding yourself in a situation when a call such as this one would consistently fail, rendering your system helpless.预计会发生故障,并且由于消息数量众多,您很快就会发现自己处于这样一种情况,即这样的呼叫会持续失败,从而使您的系统无能为力。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 brokeredmessage微软服务总线队列ReceiveBatch无法获取所有死信消息 - brokeredmessage microsoft service bus queue ReceiveBatch not obtaining all dead letter messages 通过MessageId在Azure Service Bus死信队列上获取消息 - Getting a Message by MessageId on the Azure Service Bus Dead Letter queue Azure Service Bus中死信队列中的邮件是否过期? - Do messages in dead letter queues in Azure Service Bus expire? 使用 RabbitMQ 死信队列消息 - Consume RabbitMQ Dead letter queue messages 我们可以使用 .net 代码从 Azure 服务总线中的死信队列中删除基于序列号的特定死信消息吗? - can we delete a specific dead letter message based on the sequence number from dead letter queue in Azure service bus using .net code? 死信队列中的服务总线克隆不起作用 - Service Bus Clone from Dead Letter Queue Not Working 如何在 Azure 服务总线中显式向主题订阅死信队列发送消息 - How to send message to Topic Subscription Dead Letter Queue Explicitly in Azure Service Bus 如何使用命名空间终结点获取带有死信消息的天蓝色队列列表? - How to get azure queue list with dead letter messages using namespace endpoint? 使用存储队列和服务总线时,Azure 死信队列和毒药队列有什么区别? - What is the difference between Azure Dead Letter Queues and Poison Queues when using Storage Queue and Service Bus? 死信队列未清除 - Dead letter queue not cleared
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM