Пример #1
0
        public ChannelFactory(IConnectionFactory connectionFactory, RawRabbitConfiguration config, ChannelFactoryConfiguration channelConfig)
        {
            _connectionFactory = connectionFactory;
            _config            = config;
            _channelConfig     = channelConfig;
            _requestQueue      = new ConcurrentQueue <TaskCompletionSource <IModel> >();
            _channels          = new LinkedList <IModel>();

            ConnectToBroker();
            Initialize();
        }
Пример #2
0
		public ChannelFactory(IConnectionFactory connectionFactory, RawRabbitConfiguration config, ChannelFactoryConfiguration channelConfig)
		{
			_connectionFactory = connectionFactory;
			_config = config;
			_channelConfig = channelConfig;
			_requestQueue = new ConcurrentQueue<TaskCompletionSource<IModel>>();
			_channels = new LinkedList<IModel>();

			ConnectToBroker();
			Initialize();
		}
Пример #3
0
		public ChannelFactoryTests()
		{
			_connectionFactory = new Mock<IConnectionFactory>();
			_connection = new Mock<IConnection>();
			_firstChannel = new Mock<IModel>();
			_secondChannel = new Mock<IModel>();
			_thirdChannel = new Mock<IModel>();
			_config = RawRabbitConfiguration.Local;
			_channelConfig = ChannelFactoryConfiguration.Default;

			_connectionFactory
				.Setup(c => c.CreateConnection(It.IsAny<IList<string>>()))
				.Returns(_connection.Object);
		}
Пример #4
0
        public ChannelFactory(IConnectionFactory connectionFactory, RawRabbitConfiguration config, ChannelFactoryConfiguration channelConfig)
        {
            try
            {
                _connection = connectionFactory.CreateConnection(config.Hostnames);
            }
            catch (BrokerUnreachableException e)
            {
                _logger.LogError("Unable to connect to broker", e);
                throw e.InnerException;
            }
            _connectionFactory = connectionFactory;
            _config            = config;
            _channelConfig     = channelConfig;
            _requestQueue      = new ConcurrentQueue <TaskCompletionSource <IModel> >();
            _channels          = new LinkedList <IModel>();

            Initialize();
        }
Пример #5
0
        public ChannelFactory(IConnectionFactory connectionFactory, RawRabbitConfiguration config, ChannelFactoryConfiguration channelConfig)
        {
            try
            {
                _connection = connectionFactory.CreateConnection(config.Hostnames);
            }
            catch (BrokerUnreachableException e)
            {
                _logger.LogError("Unable to connect to broker", e);
                throw e.InnerException;
            }
            _connectionFactory = connectionFactory;
            _config = config;
            _channelConfig = channelConfig;
            _requestQueue = new ConcurrentQueue<TaskCompletionSource<IModel>>();
            _channels = new LinkedList<IModel>();

            Initialize();
        }