예제 #1
0
        private void DoInitialize()
        {
            lock (_lifecycleMonitor)
            {
                if (IsRunning || !IsAutoStartup)
                {
                    return;
                }

                if (RetryTemplate == null && !RetryDisabled)
                {
                    RetryTemplate = new PollyRetryTemplate(new Dictionary <Type, bool>(), DECLARE_MAX_ATTEMPTS, true, DECLARE_INITIAL_RETRY_INTERVAL, DECLARE_MAX_RETRY_INTERVAL, DECLARE_RETRY_MULTIPLIER, _logger);
                }

                if (ConnectionFactory is CachingConnectionFactory && ((CachingConnectionFactory)ConnectionFactory).CacheMode == CachingMode.CONNECTION)
                {
                    _logger?.LogWarning("RabbitAdmin auto declaration is not supported with CacheMode.CONNECTION");
                    return;
                }

                ConnectionFactory.AddConnectionListener(this);
                IsRunning = true;
            }
        }