Beispiel #1
0
        public RabbitMQClient(RabbitMQSection configuration)
        {
            _rabbitMqFactory = new ConnectionFactory
            {
                AutomaticRecoveryEnabled  = true,
                UseBackgroundThreadsForIO = true,
                HostName                     = configuration.HostName,
                UserName                     = configuration.UserName,
                Password                     = configuration.Password,
                VirtualHost                  = configuration.VirtualHost,
                ContinuationTimeout          = TimeSpan.FromMilliseconds(configuration.ContinuationTimeout),
                HandshakeContinuationTimeout = TimeSpan.FromMilliseconds(configuration.ContinuationTimeout),
                RequestedConnectionTimeout   = configuration.SocketTimeout,
                SocketReadTimeout            = configuration.SocketTimeout,
                SocketWriteTimeout           = configuration.SocketTimeout,
                NetworkRecoveryInterval      = TimeSpan.FromSeconds(1)
            };

            _rabbitMqConnection = new Lazy <IConnection>(() => _rabbitMqFactory.CreateConnection());
        }
Beispiel #2
0
 public RabbitMQClient(string configurationName) : this(RabbitMQSection.FromSection(configurationName))
 {
 }