In the Microsoft.ServiceBus .NET library there is an object called SessionHandlerOptions with various properties on it. I can find no description to how these actually operate anywhere. MessageWaitTimeout, MaxConcurrentSessions, AutoComplete, and AutoRenewTimeout.
In my particular use case, I'm trying to discern what AutoComplete actually does specifcally.
Is it meant to close a session (so release the session lock on all messages with that session id) automatically once the last message with a particular session ID in the queue is marked as complete/dead-lettered - without the need to actually call MessageSession.Close() by the consumer?
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Hi @boylec Thank you for your feedback! We will investigate and get back to you with our findings.
@boylec Were you looking for practical examples of their uses or the SDK descriptions? Have you reviewed the details and descriptions on the SDK here:
@boylec We will now proceed to close this thread for now. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.
@mike-urnun-msft , I reviewed all of that and it doesn't reveal what is actually going on when you turn on the AutoComplete property. The documentation simply says:
"true if the autocomplete option of the session handler is enabled; otherwise, false."
I have the same question. And since the documentation is not technical enough source code is perfect documentation. Here you can see what it actually does
https://github.com/Azure/azure-service-bus-dotnet/blob/v3.3.0/src/Microsoft.Azure.ServiceBus/SessionReceivePump.cs#L87-L91
And if you will not complete a message via AutoComplete
or manually you will get this https://stackoverflow.com/a/49683593/1400547
Thanks, I should have totally looked at the source code.
So based on my interpretation of the source code the answer is:
SessionHandlerOptions.AutoComplete causes the message to complete (literally message.Complete() is called for you) and be marked for removal from the queue once your custom ‘OnMessage’ callback finishes.
(The same way MessageHandlerOptions.AutoComplete works but for a session-enabled queue.)
The “session” will continue to try and “pump” messages from the queue at that point; other messages with the same session id.
If no message with the same session id is received before the MessageWaitTimeout setting is reached, then the session is closed.
When the session is closed, it means the lock is released for that “pump” and it frees up a thread to go receive the next available session off of the queue, which is based on the MaxConcurrentSessions setting.
@mike-urnun-msft, can you update description on the SDK with the details provided in the answer https://github.com/MicrosoftDocs/azure-docs/issues/17047#issuecomment-472377046 ?
SessionHandlerOptions.AutoComplete Property https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.servicebus.sessionhandleroptions.autocomplete?view=azure-dotnet#Microsoft_Azure_ServiceBus_SessionHandlerOptions_AutoComplete
Most helpful comment
Thanks, I should have totally looked at the source code.
So based on my interpretation of the source code the answer is:
SessionHandlerOptions.AutoComplete causes the message to complete (literally message.Complete() is called for you) and be marked for removal from the queue once your custom ‘OnMessage’ callback finishes.
(The same way MessageHandlerOptions.AutoComplete works but for a session-enabled queue.)
The “session” will continue to try and “pump” messages from the queue at that point; other messages with the same session id.
If no message with the same session id is received before the MessageWaitTimeout setting is reached, then the session is closed.
When the session is closed, it means the lock is released for that “pump” and it frees up a thread to go receive the next available session off of the queue, which is based on the MaxConcurrentSessions setting.