Ejemplo n.º 1
0
        protected AbstractConnectionFactory(
            RabbitMQ.Client.IConnectionFactory rabbitConnectionFactory,
            AbstractConnectionFactory publisherConnectionFactory,
            ILogger logger = null)
        {
            if (rabbitConnectionFactory == null)
            {
                throw new ArgumentNullException(nameof(rabbitConnectionFactory));
            }

            _rabbitConnectionFactory   = rabbitConnectionFactory;
            PublisherConnectionFactory = publisherConnectionFactory;
            _logger          = logger;
            RecoveryListener = new DefaultRecoveryListener(logger);
            BlockedListener  = new DefaultBlockedListener(logger);
            Name             = GetType().Name + "@" + GetHashCode();
        }
        protected AbstractConnectionFactory(
            RabbitMQ.Client.IConnectionFactory rabbitConnectionFactory,
            AbstractConnectionFactory publisherConnectionFactory,
            ILoggerFactory loggerFactory = null)
        {
            if (rabbitConnectionFactory == null)
            {
                throw new ArgumentNullException(nameof(rabbitConnectionFactory));
            }

            _loggerFactory             = loggerFactory;
            _logger                    = _loggerFactory?.CreateLogger(GetType());
            _rabbitConnectionFactory   = rabbitConnectionFactory;
            _connectionListener        = new CompositeConnectionListener(_loggerFactory?.CreateLogger <CompositeConnectionListener>());
            _channelListener           = new CompositeChannelListener(_loggerFactory?.CreateLogger <CompositeConnectionListener>());
            PublisherConnectionFactory = publisherConnectionFactory;
            RecoveryListener           = new DefaultRecoveryListener(_loggerFactory?.CreateLogger <DefaultRecoveryListener>());
            BlockedListener            = new DefaultBlockedListener(_loggerFactory?.CreateLogger <DefaultBlockedListener>());
            ServiceName                = GetType().Name + "@" + GetHashCode();
        }