Azure / azure-service-bus

☁️ Azure Service Bus service issue tracking and samples
https://azure.microsoft.com/services/service-bus
MIT License
580 stars 775 forks source link

Message lock duration is not working due to SessionIdleTimeout #696

Open kimberlyyong opened 4 months ago

kimberlyyong commented 4 months ago

Description

When message is not completed, the message not supposed to be processed until the Lock Duration expire. Message Lock Duration is set to 5 minutes image But non completed messages were retried every 10 seconds. image

Actual Behavior

  1. Message is being processed as soon as SessionIdleTimeout kick in

Expected Behavior

  1. Even SessionIdleTimeout , message still should not be picked up until the original locked duration expires.

Here is my code, this is to work around this issue https://github.com/Azure/azure-service-bus/issues/454#issuecomment-1932230429 var runResult = await ProcessEvent(retryAndExecutor, eventName, messageData, message.ApplicationProperties); if (runResult) { _logger.LogInformation($"Complete operation: {retryAndExecutor.Id} {args.Print()}"); await args.CompleteMessageAsync(message); } else { if (retryAndExecutor.HasChanged) { _logger.LogInformation($"Defer operation: {retryAndExecutor.Id} immediately, delivery count increased {args.Print()}"); await args.AbandonMessageAsync(message, retryAndExecutor.ApplicationProperties); } else { var timeInQueue = DateTimeOffset.UtcNow.Subtract(args.Message.EnqueuedTime).TotalMinutes; if (timeInQueue > _maxMinutesToProcess) { _logger.LogInformation($"DLQ operation: {retryAndExecutor.Id} timeInQueue {timeInQueue} exceeds {_maxMinutesToProcess} minutes. {args.Print()}"); await args.DeadLetterMessageAsync(message, $"TimeInQueue exceeds limit {_maxMinutesToProcess}"); } else { _logger.LogInformation($"Defer operation: {retryAndExecutor.Id} with message lock duration delay, delivery count stays the same {args.Print()}"); } } }

EldertGrootenboer commented 4 months ago

Thank you for your feedback. We have opened an investigation task for this in our backlog, and will update this issue when we have more information.

EldertGrootenboer commented 2 months ago

This item in our backlog, however we currently don't have an ETA on when development might start on this. For now, to help us give this the right priority, it would be helpful to see others vote and support this item.

anbeng commented 1 month ago

Experiencing the same issue. Would like to use functionality if possible please.