paramore.brighter.commandprocessor.messaginggateway.rmq.MessageGatewayConnectionPool.GetConnection C# (CSharp) Метод

GetConnection() публичный Метод

Return matching RabbitMQ connection if exist (match by amqp scheme) or create new connection to RabbitMQ (thread-safe)
public GetConnection ( ConnectionFactory connectionFactory ) : IConnection
connectionFactory RabbitMQ.Client.ConnectionFactory
Результат IConnection
        public IConnection GetConnection(ConnectionFactory connectionFactory)
        {
            var connectionId = GetConnectionId(connectionFactory);

            IConnection connection;
            var connectionFound = s_connectionPool.TryGetValue(connectionId, out connection);

            if (connectionFound != false && connection.IsOpen != false) 
                return connection;

            lock (s_lock)
            {
                connectionFound = s_connectionPool.TryGetValue(connectionId, out connection);

                if (connectionFound == false || connection.IsOpen == false)
                {
                    connection = CreateConnection(connectionFactory);
                }
            }

            return connection;
        }