0

I am using MassTransit in my application and would like to configure multiple retry policies. The documentation doesn't mention how they would interact so I hope someone can clarify.

What I want to do is implement secondary retry for some consumers waiting for an available resource. In the event that the resource is unavailable, I want to throw a specific exception and retry later.

For this, I have something like this.

ep.UseRetry(retryConfig => 
{
    retryConfig.Handle<RetryLaterException>();
    retryConfig.Interval(5, TimeSpan.FromMinutes(1));
});

I also want a generic retry policy that would handle all failures except when I need a retry.

ep.UseRetry(retryConfig => 
{
    retryConfig.Ignore<RetryLaterException>();
    retryConfig.Interval(5, TimeSpan.FromSeconds(1));
});

Can MassTransit handle this? At which level should I place these retry policies for optimal results (Bus, Endpoint or Consumer)?

Thank you

frostymarvelous
  • 2,786
  • 32
  • 43
  • I would suggest to use redelivery aka second level retries. – Alexey Zimarev Aug 13 '17 at 15:46
  • @AlexeyZimarev I currently cannot use Quartz and I can't rely on the Rabbit MQ plugin for delayed exchanges that's mentioned in the docs. That was my initial goto. – frostymarvelous Aug 14 '17 at 12:37
  • 1
    It can handle it, and I'm not sure if the order matters, but you'd need to have a separate retry policy like you have shown and it should work as long as there isn't any overlap between the two. – Chris Patterson Aug 15 '17 at 16:17
  • awesome. thanks @ChrisPatterson. I will definitely post my results when I get the time to finally test this implementation. – frostymarvelous Aug 15 '17 at 16:42

0 Answers0