MassTransit/RabbitMq Error queue - how to delete messages?

自古美人都是妖i 提交于 2021-01-28 17:17:09

问题


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>());
                            }
                        );
                    

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.

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

How to acknowledge those messages?


回答1:


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

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 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..



来源:https://stackoverflow.com/questions/64008063/masstransit-rabbitmq-error-queue-how-to-delete-messages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!