问题
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