public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context,
                                                               CancellationToken cancellationToken = default)
        {
            try
            {
                var connectionKey = $"{ConnectionKey}_{_topicName}";
                if (!ManagementClientConnections.TryGetValue(connectionKey, out var managementClient))
                {
                    managementClient = CreateManagementClient();
                    if (!ManagementClientConnections.TryAdd(connectionKey, managementClient))
                    {
                        return(new HealthCheckResult(context.Registration.FailureStatus,
                                                     "New service bus administration client can't be added into dictionary."));
                    }
                }

                _ = await managementClient.GetTopicRuntimePropertiesAsync(_topicName, cancellationToken);

                return(HealthCheckResult.Healthy());
            }
            catch (Exception ex)
            {
                return(new HealthCheckResult(context.Registration.FailureStatus, exception: ex));
            }
        }
        public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
        {
            try
            {
                var managementClient = ManagementClientConnections.GetOrAdd(ConnectionKey, key => CreateManagementClient());
                _ = await managementClient.GetSubscriptionRuntimePropertiesAsync(_topicName, _subscriptionName, cancellationToken);

                return(HealthCheckResult.Healthy());
            }
            catch (Exception ex)
            {
                return(new HealthCheckResult(context.Registration.FailureStatus, exception: ex));
            }
        }
        public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
        {
            try
            {
                var managementClient = ManagementClientConnections.GetOrAdd(ClientConnectionKey, _ => CreateManagementClient());
                _ = await managementClient.Operations.ListWithHttpMessagesAsync(cancellationToken : cancellationToken);

                return(HealthCheckResult.Healthy());
            }
            catch (Exception ex)
            {
                return(new HealthCheckResult(context.Registration.FailureStatus, exception: ex));
            }
        }