Rabbitmq 发生非暂时性错误时的MassTransit旁路重试策略

Rabbitmq 发生非暂时性错误时的MassTransit旁路重试策略,rabbitmq,masstransit,Rabbitmq,Masstransit,对非暂时性错误短路重试策略的指导是什么 场景。 使用连接到RabbitMq的MassTransit v3。 一个简单的重试策略在管道中尝试5次设置。 在消息的使用中,会发生不可恢复的错误,而不是引发异常并重试4次。我想将此消息移动到错误队列。您可以使用: Retry.Except<BadException>().Immediate(5); Retry.Except().Immediate(5); 由于某种原因,克里斯的解决方案对我不起作用。也许我打这个电话的背景不对。唯一有效的方法

对非暂时性错误短路重试策略的指导是什么

场景。

使用连接到RabbitMq的MassTransit v3。 一个简单的重试策略在管道中尝试5次设置。 在消息的使用中,会发生不可恢复的错误,而不是引发异常并重试4次。我想将此消息移动到错误队列。

您可以使用:

Retry.Except<BadException>().Immediate(5);
Retry.Except().Immediate(5);

由于某种原因,克里斯的解决方案对我不起作用。也许我打这个电话的背景不对。唯一有效的方法是进行两次用户调用:

            configurator.ReceiveEndpoint(host, _config.QueueName, ec =>
            {
                ...

                // Configure retries to immediately fail on permanent consumer faults
                ec.UseRetry(r => r.None().Handle<ConsumerPermanentFaultException>());

                // Configure all other retries as incremental
                ec.UseRetry(r =>
                {
                    r.Incremental(_config.RetryCount, _config.RetryInterval, _config.RetryIntervalIncrement)
                        .Ignore<ConsumerPermanentFaultException>();
                });

                // Load consumers from the container
                ec.LoadFrom(consumerContainer);
            });
configurator.ReceiveEndpoint(主机,\u config.QueueName,ec=>
{
...
//将重试配置为在永久性使用者故障时立即失败
(r=>r.None().Handle());
//将所有其他重试配置为增量
ec.usery(r=>
{
r、 增量(_config.RetryCount、_config.RetryInterval、_config.RetryIntervalIncrement)
.Ignore();
});
//从容器中装入耗电元件
ec.LoadFrom(消费者容器);
});

Ok看起来就是这样。var retryPolicy=new-ExponentialRetryPolicy(筛选器:new-policyExceptionPolicyExceptionFilter(typeof(SchemaValidationException)),retryLimit:5,MiniInterval:TimeSpan.FromSeconds(1),maxInterval:TimeSpan.FromSeconds(30),intervalDelta:TimeSpan.FromSeconds(5));