我正在使用 Masstransit+RabbitMQ.我的一位消费者实施了重试策略,我想知道一旦消息在错误队列中,是否有任何方法可以重试消息?
I'm using Masstransit+RabbitMQ. One of the my consumers implements retry policy and I'm wondering if there any way to get message's retries amout once message is in the error queue?
我还想知道 MT 计数是如何重试的,因为我没有使用 RabbitMq 服务器在消息头中查找任何相关信息.
Also I would like to know how MT counting retries because I didn't namage to find any related information in message's headers using RabbitMq server.
谢谢.
您可以在您的消费者中使用以下方法重试重试次数.
You can, in your consumer, use the following method to retry the retry attempt number.
consumeContext.GetRetryAttempt()
如果当前处理尝试是重试,它应该返回 > 0.
It should return > 0 if the current processing attempt is a retry.
一旦达到重试限制,下一个版本的 MassTransit (v6) 将在错误队列 MT-Fault-RetryCount
中包含一个标头,其中包含已尝试的重试次数.此外,Fault<T>
消息将具有相同的可用标头.
Once the retry limit is reached, the next version of MassTransit (v6) will include a header in the error queue MT-Fault-RetryCount
which will have the number of retries that were attempted. Also, Fault<T>
messages will have that same header available.
这篇关于获取 MassTransit 消息重试次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!