MassTransit客户部分故障重试策略

时间:2019-03-21 14:30:59

标签: c# masstransit

说我有以下消费者,其中有重试策略:

public class RetryOnlyFailedPartConsumer : IConsumer<Command>
{
    public async Task Consume(ConsumeContext<Command> context)
    {
        await DoSomething();
        await DoSomethingElse(); 
    }

    private async Task DoSomething()
    {
        // Some discrete piece of work
    }

    private async Task DoSomethingElse()
    {
        throw new Exception();
    }
}

当发生异常时,我只想重试失败的部分,在这种情况下,DoSomethingElse(),并跳过DoSomething(),因为它成功阻止了多次执行。我该怎么办?

0 个答案:

没有答案