I am using Azure.Messaging.ServiceBus .net sdk for my project. If I use 5 different ServiceBusClient objects but use the same AzureSasCredential object while creating the above-said clients, and I update the AzureSasCredential object with ".Update(newSasToken), does it apply to all 5 clients and have their validity updated? I am of the understanding that any operation using the clients thereafter will present the new SasToken that was updated and will work with a new token validity. Please clarify.
On another note, if the clients are not used to send/receive for a long time(a few hours) after a bout of send/receive operations, will their connections go to "sleep" under the hood or will they still be counted as "Active Connection" on my Service Bus namespace?
Yes. When you pass the AzureSasCredential
to a client, the client holds that reference. When Update
is called, the new token value will be available to anyone with a reference. In the case of a SerivceBusClient
, the new token will be sent the next time that authorization is renewed.
Connections have an idle timeout on the client side (60 seconds by default) and on the service-side (currently 30 minutes, but may change). At some point after one of those timeouts is exceeded, within a small window of non-determinism, the connection will be closed ad no longer counted against your limit. The client will recreate the connection for the next service operation that is requested.