I believe the correct behavior should be to manually call CompleteMessageAsync when AutoComplete is disabled. So, I think this line should be modified to if (!_serviceBusProcessor!.AutoCompleteMessages).
Additionally, the default value of the AutoCompleteMessages property in AzureServiceBusOptions should be set to false. It was changed to true in a previous commit.
What do you think about this and am I missing something?
Hi @mviegas
I received a subscription sponsorship for Azure ASB from Microsoft. Today, while testing Azure Service Bus, I encountered a "The lock supplied is invalid" error. I searched for the same issue on StackOverflow: https://stackoverflow.com/questions/28127001/the-lock-supplied-is-invalid-either-the-lock-expired-or-the-message-has-alread. The answer pointed towards the AutoCompleteMessages setting.
I checked the definition of AutoCompleteMessages.
It seems there's a logic error when acknowledging messages.
See https://github.com/dotnetcore/CAP/blob/4d69d3eac12c4da9dd179442dc9f63501f5e8f9d/src/DotNetCore.CAP.AzureServiceBus/AzureServiceBusConsumerClient.cs#L131-L132
I believe the correct behavior should be to manually call
CompleteMessageAsync
when AutoComplete is disabled. So, I think this line should be modified toif (!_serviceBusProcessor!.AutoCompleteMessages)
.Additionally, the default value of the
AutoCompleteMessages
property inAzureServiceBusOptions
should be set to false. It was changed to true in a previous commit.What do you think about this and am I missing something?