MassTransit/RabbitMq错误队列-如何删除消息? [英] MassTransit/RabbitMq Error queue - how to delete messages?

查看:88
本文介绍了MassTransit/RabbitMq错误队列-如何删除消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个队列{QueueName}.我定义了一个消费者和错误消息消费者,如下所示:

I have a queue {QueueName}. I defined a consumer and faulted-messages consumer as follows:

                        cfg.ReceiveEndpoint
                        (
                            queueName: QueueName,
                            e =>
                            {
                                 e.UseMessageRetry(r => r.Immediate(2));

                                e.AutoDelete = false;
                                e.Durable = true;
                                e.Consumer(() => container.Resolve<My_Consumer>());
                                e.Consumer(() => container.Resolve<My_Fault_Consumer>());
                            }
                        );
                    

当消费者用尽其尝试次数来处理该消息时,出现故障的消息消费者就会加入并通过记录错误来处理该消息.我已经注意到创建了名为{QueueName} _error的额外队列.

When consumer dries out its attempts number to handle the message, the faulted-message-consumer kicks in and handles the message by logging the error. I've noticed there is extra queue created, named {QueueName}_error.

My_Fault_Consumer不确认错误消息的消耗,并且队列增加.

The My_Fault_Consumer does not acknowledge the fault-message consumption and the queue grows.

如何确认这些消息?

推荐答案

error 队列是中毒队列,或者是

The error queue is the poison queue, or the invalid message channel

Fault< T> 消息的使用者使用此队列. Fault 消息将与其他任何消息一起发布.如果您查看中毒队列的内容,您将看不到任何 Fault 消息,因为它打算保留您的消费者无法使用的原始消息.

The consumer of Fault<T> messages does not use this queue. The Fault messages get published as any other messages. If you look at the content of the poison queue, you will not see any Fault messages there since it intends to keep the original messages, which your consumer failed to consume.

这里的目的是您能够查看这些消息并最终决定将它们移回原始队列以进行重新处理,或者只是评估这些消息的内容以进行故障排除.

The intention here is that you are able to look at those messages and eventually decide to move them back to the original queue for re-processing, or just evaluate the content of those messages for troubleshooting purposes.

MassTransit对该队列不执行任何操作,也不会从该队列中删除消息.您可以自己从UI或使用管理API或您的代理来完成此操作.

MassTransit does nothing with that queue and woun't delete messages from there. You can do it yourself from the UI or using the management API or your broker..

这篇关于MassTransit/RabbitMq错误队列-如何删除消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆