cfg.UseRetry(); with the new Lambda-based retry policy configurator throw exceptions
See original GitHub issueGetting exceptions that the RetryPolicy cannot be null, after i Upgraded to MT 3.5.4.
The service bus was not properly configured: [Failure] RetryPolicy must not be null
private static IBusControl CreateIBusControl(Container container)
{
var configurator = container.GetInstance<IBusConfigurator>();
var bus = configurator
.CreateBus((cfg, host) =>
{
cfg.ReceiveEndpoint<CollectCommand>(c =>
{
c.LoadFrom(container);
});
// works
cfg.UseRetry(Retry.Exponential(3, TimeSpan.FromSeconds(5), TimeSpan.FromMinutes(2), TimeSpan.FromSeconds(5)));
// doesn't work
cfg.UseRetry(r => Retry.Exponential(3, TimeSpan.FromSeconds(5), TimeSpan.FromMinutes(2), TimeSpan.FromSeconds(5)));
})
.ConfigureAwait(false)
.GetAwaiter()
.GetResult();
return bus;
}
Using this configurator helper class:
public async Task<IBusControl> CreateBus(Action<IBusFactoryConfigurator, IHost> registrationAction = null, Action<IRetryConfigurator> retryGlobalPolicy = null)
{
var t = await Task.Run(() =>
{
var connUri = new Uri(Configuration.ConnectionUri);
var bus = Bus.Factory.CreateUsingAzureServiceBus(cfg =>
{
var host = cfg.Host(connUri, hst =>
{
hst.TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(Configuration.Login, Configuration.Password);
});
registrationAction?.Invoke(cfg, host);
cfg.UseJsonSerializer();
});
return bus;
});
return t;
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
.net - MassTransit Retry policy throws System. ...
It's throwing a configuration exception because you didn't actually configure the retry. The retry usage is covered in the documentation.
Read more >Exceptions
Shown below is a retry policy which attempts to deliver the message to a consumer five times before throwing the exception back up...
Read more >Error handling and automatic retries in AWS Lambda
Function – Your function's code throws an exception or returns an error object. Runtime – The runtime terminated your function because it ran...
Read more >Implementing Retry with Resilience4j
As a general policy, we want to retry when this exception is thrown. But there is one subclass of SeatsUnavailableException which we don't...
Read more >Error Handling and Message Redelivery in MassTransit
With default bus configuration, exceptions are caught by MassTransit ... an e-mail logic... throw new Exception("Something's happened during processing.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ah, so simple a miss and course it works now when actually using the lambda! (using r.* not Retry.*) Much gratitude for the effort and time used to answer this issue!
Pull request submitted, short answer, you weren’t using the lambda, you were just doing essentially a no-op in the method.