What would you like to be added:
The HealthChecks.AzureServiceBus makes use of ConcurrentDictionary to reuse clients for queues and topics. However, the connection key is generated by using both the service bus connection-string/endpoint+queue-name/topic-name. which means that multiple health check to queues/topics within the same Service Bus will create multiple clients, where it should only create a single client and us that for all of the queues/topics in that Service Bus.
I propose to change the connection key to only use the connection-string/endpoint as the key in the client dictionary and change the code to use the ClientCache instead of an internal ConcurrentDictionary to reuse clients across the individual HealthCheck implementations.
The relevant Azure ServiceBus HealthCheck implementations that I would like to be modified:
Why is this needed:
Can reduce the amount of open connection to the same Service Bus and reduce the execution time for the first call where clients are created.
I don't see any conflict which this change unless I have overlooked a specific use case.
I also have a PR ready which this change if approved as a valid solution.
What would you like to be added: The HealthChecks.AzureServiceBus makes use of
ConcurrentDictionary
to reuse clients for queues and topics. However, the connection key is generated by using both the service busconnection-string/endpoint
+queue-name/topic-name
. which means that multiple health check to queues/topics within the same Service Bus will create multiple clients, where it should only create a single client and us that for all of the queues/topics in that Service Bus.I propose to change the connection key to only use the
connection-string/endpoint
as the key in the client dictionary and change the code to use theClientCache
instead of an internalConcurrentDictionary
to reuse clients across the individualHealthCheck
implementations.The relevant Azure ServiceBus HealthCheck implementations that I would like to be modified:
Why is this needed: Can reduce the amount of open connection to the same Service Bus and reduce the execution time for the first call where clients are created.
I don't see any conflict which this change unless I have overlooked a specific use case.
I also have a PR ready which this change if approved as a valid solution.