Currently, I´m in a situation where an event needs to update a certain number of records in the DB. Usually, this does not take more than a couple of seconds, but there can be scenarios where can take more than 1 minute. In this scenario, the consumer takes the same message after 30 seconds and retry it.
I was wondering if I can increase that time to wait maybe up to 5 minutes for those rare scenarios without using JobConsumers.
CodePudding user response:
Are you configuring the LockTimeout
on the receive endpoint for 30 seconds? MassTransit defaults to 5 minutes, but if the queue already has a lower configured lock timeout, Azure Service Bus will only wait that time period before redelivering the message. If the queue already exists, you'd need to update the queue properties using the Azure Portal, or delete the queue so that MassTransit recreates it (any messages would be lost).
You can also set MaxDeliveryCount
to 1
and Azure will move the message to the dead-letter queue after one attempt. The first approach is better though.