I have a MassTransit Consumer that should on average complete its messages in 15-20 minutes.
I am using Azure.ServiceBus.Core transport.
The message will successfully operate through all configured business logic, but the message instead faults on a MassTransit.MessageLockExpiredException
after the message completes.
I've tried setting MaxAutoRenewDuration and LockDuration
x.UsingAzureServiceBus((context, cfg) =>
{
cfg.Host(hostContext.Configuration["AzureServiceBus_ConnectionString"]);
cfg.UseConsumeFilter(typeof(ConsumeContextFilter<>), context);
cfg.ConfigureEndpoints(context);
cfg.MaxAutoRenewDuration = TimeSpan.FromMinutes(30);
cfg.LockDuration = TimeSpan.FromMinutes(30);
});
You need to configure the properties on the receive endpoint, not the bus.
x.AddConfigureEndpointsCallback((context, name, cfg) =>
{
if(cfg is IServiceBusReceiveEndpointConfigurator sb)
{
sb.LockDuration = TimeSpan.FromMinutes(5);
sb.MaxAutoRenewDuration = TimeSpan.FromMinutes(30);
});
});