3

Context: MSDN documentation on Service Bus queues and message sessions says "When the MessageSession object is accepted and while it is held by a client, that client holds an exclusive lock on all messages with that session's SessionId that exist in the queue or subscription, and also on all messages with that SessionId that still arrive while the session is held.

Question: Can the per-session lock be configured to be released after some time period, unless it’s renewed? I ask in case the client becomes unhealthy and can’t release the lock on its own.

Craig
  • 1,890
  • 1
  • 26
  • 44

1 Answers1

0

SessionClient relies on the underlying AMQP connection. If you CloseAsync() message session, it will become available to another consumer.

Sean Feldman
  • 23,443
  • 7
  • 55
  • 80
  • But if my code can’t call Close for some reason (like a bug), is there a way to configure the session lock to timeout on its own? – Craig Mar 13 '19 at 13:18
  • Connection will time out after a default period of time. You can configure timeout period on the `ServiceBusConnection` object. In the [next release](https://github.com/Azure/azure-service-bus-dotnet/pull/644) you'll be able to do that via connection string. – Sean Feldman Mar 14 '19 at 02:42