Пример #1
0
        public void StartConsuming(ConsumerEventHandler messageReceived, string queueName, bool?exclusive = null, bool?autoDelete = null)
        {
            _consumerEventHandler = messageReceived;
            _queueName            = queueName;
            _retryQueueName       = queueName + ".Retries";
            _errorExchange        = _transportSettings.ErrorQueueName;
            _auditExchange        = _transportSettings.AuditQueueName;

            if (autoDelete.HasValue)
            {
                _autoDelete = autoDelete.Value;
            }

            Retry.Do(CreateConsumer, ex =>
            {
                _logger.Error(string.Format("Error creating model - queueName: {0}", queueName), ex);
            }, new TimeSpan(0, 0, 0, _retryTimeInSeconds), _retryCount);
        }
Пример #2
0
        public void StartConsuming(ConsumerEventHandler messageReceived, string queueName, bool?exclusive = null, bool?autoDelete = null)
        {
            _consumerEventHandler = messageReceived;
            _queueName            = queueName;

            if (exclusive.HasValue)
            {
                _exclusive = exclusive.Value;
            }

            if (autoDelete.HasValue)
            {
                _autoDelete = autoDelete.Value;
            }

            Retry.Do(CreateConsumer, ex =>
            {
                Logger.Error(string.Format("Error creating consumer - queueName: {0}", queueName), ex);
                DisposeConnection();
                SwitchHost();
            }, new TimeSpan(0, 0, 0, 10));
        }