As you know, in Masstransit, we can set up a UseMessageRetry. This method can help us to retry the message sending process once more. This process continues as long as we hit errors. The problem that I have encountered is that this setting is a singleton for every message. What I seek to have is to set a different configuration for a particular message(courier).
the setting I have set for all messages is as follows:
config.UseMessageRetry(x =>
{
x.Incremental(100,
TimeSpan.FromSeconds(1),
TimeSpan.FromMilliseconds(100));
});
I would be thankful if somebody can help me out.
When configuring message retry at the bus configuration level, that retry policy applies to all receive endpoints. To configure a different policy for specific receive endpoints, you'd need to specify a different retry policy in the receive endpoint configuration.
A better way to configure the receive endpoints if you're using ConfigureEndpoints()
is to register an IConfigureReceiveEndpoint
type and check the queue name to see if it matches an execute or compensate queue name, and apply a different retry in that scenario.