public void Load(RabbitConfiguration configuration)
        {
            if (Log.IsInfoEnabled)
                Log.Info("Loading configuration from code");

            _codeConfiguration = configuration;
        }
        public RabbitConfiguration Get()
        {
            if(Log.IsInfoEnabled)
                Log.Info("Trying to get RabbitConfiguration...");

            if (_currentConfiguration != null)
            {
                if (Log.IsDebugEnabled)
                    Log.Debug("Configuration already exists.");
                return _currentConfiguration;
            }

            if(_appConfigConfiguration == null)
            {
                lock (_syncLock)
                {
                    if(_appConfigConfiguration == null)
                    {
                        if (Log.IsInfoEnabled)
                            Log.Info("Loading configuration from Application Configuration file...");

                        _appConfigConfiguration = RabbitConfiguration.FromConfiguration();

                        if (Log.IsInfoEnabled)
                            Log.Info("Configuration from Application Configuration file loaded.");
                    }
                }
            }

            if (_appConfigConfiguration != null)
            {
                if (Log.IsInfoEnabled)
                    Log.Info("Application Configuration file configuration will be used.");

                _currentConfiguration = _appConfigConfiguration;
                return _appConfigConfiguration;
            }

            if (_codeConfiguration != null)
            {
                if (Log.IsInfoEnabled)
                    Log.Info("Code configuration will be used.");

                _currentConfiguration = _codeConfiguration;
                return _codeConfiguration;
            }

            if (Log.IsInfoEnabled)
                Log.Info("No configuration found.");
            _currentConfiguration = null;
            return null;
        }
Esempio n. 3
0
        public Rabbit SetupConnectionProperties(RabbitConfiguration configuration)
        {
            if (Log.IsInfoEnabled)
                Log.Info("Setting up connection properties...");

            var rabbitConfigurationProvider = ComponentLocator.Current.Get<IRabbitConfigurationProvider>();
            if(rabbitConfigurationProvider != null)
            {
                rabbitConfigurationProvider.Load(configuration);
            }

            if (Log.IsInfoEnabled)
                Log.Info("Connection properties set.");

            return this;
        }