First runnable prototype.
This commit is contained in:
@ -24,6 +24,10 @@ namespace MessengerBroker.Configuration.Model
|
||||
|
||||
public SlaveServer[] SlaveServers { get; set; }
|
||||
|
||||
public bool HousekeepingEnabled { get; set; }
|
||||
|
||||
public int HousekeepingMessageAgeInMinutes { get; set; }
|
||||
|
||||
public BrokerConfiguration(
|
||||
PersistenceConfiguration apiPersistenceConfiguration,
|
||||
PersistenceConfiguration broPersistenceConfiguration,
|
||||
@ -37,15 +41,22 @@ namespace MessengerBroker.Configuration.Model
|
||||
this.MasterServers = masters;
|
||||
this.SlaveServers = slaves;
|
||||
this.Proxies = [];
|
||||
this.HousekeepingEnabled = true;
|
||||
this.HousekeepingMessageAgeInMinutes = 180;
|
||||
}
|
||||
|
||||
public BrokerConfiguration(IEnvironmentConfigurationSource config):this(
|
||||
public BrokerConfiguration(IEnvironmentConfigurationSource config) : this(
|
||||
ApiEnvironmentPersistenceConfigurationParser.Parse(config),
|
||||
EnvironmentPersistenceConfigurationParser.Parse(config),
|
||||
config.GetValue<Guid>(Constants.EnvironmentVariables.BROKER_ID),
|
||||
MasterServerParser.Parse(config.GetValue<string>(Constants.EnvironmentVariables.MASTER_SERVERS)),
|
||||
SlaveServerParser.Parse(config.GetValue<string>(Constants.EnvironmentVariables.SLAVE_SERVERS)))
|
||||
{
|
||||
if(config.HasKey(Constants.EnvironmentVariables.HOUSEKEEPING_ENABLED))
|
||||
{
|
||||
this.HousekeepingEnabled = config.GetValue<bool>(Constants.EnvironmentVariables.HOUSEKEEPING_ENABLED);
|
||||
this.HousekeepingMessageAgeInMinutes = config.GetValue<int>(Constants.EnvironmentVariables.HOUSEKEEPING_MESSAGE_AGE_IN_MINUTES);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,5 +11,10 @@ namespace MessengerBroker.Configuration.Model.Servers
|
||||
/// Url of the Broker API we use to download the data.
|
||||
/// </summary>
|
||||
public string BrokerUrl { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{this.Name} ({this.BrokerUrl}, ID {this.BrokerId})";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,5 +7,9 @@ namespace MessengerBroker.Configuration.Model.Servers
|
||||
/// </summary>
|
||||
public class SlaveServer : Server
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{this.Name} (ID {this.BrokerId})";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user