public ConfigurationPublisher(string connectionString, int refreshTimerIntervalInMs) { string hostName = Environment.GetEnvironmentVariable("RabbitMq/Host"); string userName = Environment.GetEnvironmentVariable("RabbitMq/Username"); string passWord = Environment.GetEnvironmentVariable("RabbitMq/Password"); if (hostName == null) { _factory = new ConnectionFactory() { HostName = "localhost" }; } else { _factory = new ConnectionFactory() { HostName = hostName, UserName = userName, Password = passWord }; } _connection = _factory.CreateConnection(); _channel = _connection.CreateModel(); _channel.ExchangeDeclare(exchange: _cnstExchangeName, type: _cnstExchangeType); _configReader = new ConfigurationReader(connectionString, refreshTimerIntervalInMs); //this event will be called after each periodic (according to timer interval) reading operation _configReader.ConfigurationParametersRefreshed += ConfigurationParametersRefreshedHandler; _configReader.StartReading(); }