public QueueWatcherRabbitMQ(
            IAppLogger logger,
            IMessageProvider msgProvider,
            IQueueProviderSettings settings,
            int threadsCount = 1)
        {
            _logger      = logger ?? throw new ArgumentNullException(nameof(logger));
            _msgProvider = msgProvider ?? throw new ArgumentNullException(nameof(msgProvider));
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            _factory = new ConnectionFactory()
            {
                HostName    = settings.Host,
                Port        = settings.Port,
                VirtualHost = settings.VirtualHost,
                UserName    = settings.Login,
                Password    = settings.Password,
            };

            _semaphore   = new SemaphoreSlim(threadsCount, threadsCount);
            _threadSleep = 30000;
        }
Example #2
0
        // Maybe pass IConnection Factory in constructor? - Can't test this
        public ConnectionFactoryRabbitMQ(IQueueProviderSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            _connectionFactory = new ConnectionFactory()
            {
                HostName    = settings.Host,
                Port        = settings.Port,
                VirtualHost = settings.VirtualHost,
                UserName    = settings.Login,
                Password    = settings.Password,
            };
        }