public MessageBus(RabbitMqConnectionConfiguration configuration,
                   IEnumerable <IRabbitMqConsumer> consumers,
                   IEnumerable <IRabbitMqPublisher> publishers)
 {
     _consumers         = consumers;
     _publishers        = publishers;
     _connectionFactory = CreateConnectionFactory(configuration);
 }
        private IConnectionFactory CreateConnectionFactory(RabbitMqConnectionConfiguration configuration)
        {
            var connectionFactory = new ConnectionFactory
            {
                Uri      = new Uri(configuration.Uri),
                UserName = configuration.Username,
                Password = configuration.Password
            };

            return(connectionFactory);
        }
Exemple #3
0
        public void GetConnection_InvalidConfiguration_Fails(string userName, string password, string hostName, string virtualHost)
        {
            var invalidConfig = new RabbitMqConnectionConfiguration
            {
                UserName    = userName,
                Password    = password,
                HostName    = hostName,
                VirtualHost = virtualHost
            };
            var subject = new RabbitMqConnectionService(invalidConfig);

            var result = subject.GetConnection(_noRetryOptions);

            result.ShouldBeFail(ex => ex.Should().BeOfType <BrokerUnreachableException>());
        }
Exemple #4
0
        public void Ctor_UsesDefaultHost_WithDefaultConstructor()
        {
            RabbitMqConnectionConfiguration conf = new RabbitMqConnectionConfiguration();

            Assert.Equal(RabbitMqConnectionConfiguration.DefaultHost, conf.HostName);
        }
Exemple #5
0
        public void Ctor_UsesDefaultPassword_WithDefaultConstructor()
        {
            RabbitMqConnectionConfiguration conf = new RabbitMqConnectionConfiguration();

            Assert.Equal(RabbitMqConnectionConfiguration.DefaultPassword, conf.Password);
        }