Exemplo n.º 1
0
        /// <summary>
        /// Close rabbitmq connection
        /// </summary>
        /// <returns>management client</returns>
        private async Task CloseRabbitConnection(ManagementClient managementClient)
        {
            var rabbitConnections = await managementClient.GetConnectionsAsync(CancellationToken.None);

            foreach (var connection in rabbitConnections)
            {
                try
                {
                    await managementClient.CloseConnectionAsync(connection, CancellationToken.None);
                }
                catch (Exception exp)
                {
                    _logger.Error(exp, $"Error closing connection: {exp.Message}");
                }
            }
        }