Remove Configure() from ITelemetryPublisher

This commit is contained in:
Denis-Cosmin Nutiu 2019-11-23 19:05:18 +02:00
parent 38f5edbe2b
commit 2d4d3c347d
4 changed files with 3 additions and 12 deletions

View file

@ -9,7 +9,6 @@ namespace NucuCar.Domain.Telemetry
{ {
void Start(); void Start();
Task StartAsync(); Task StartAsync();
void Configure(Dictionary<string, object> config);
bool RegisterTelemeter(ITelemeter t); bool RegisterTelemeter(ITelemeter t);
bool UnRegisterTelemeter(ITelemeter t); bool UnRegisterTelemeter(ITelemeter t);
Task PublishAsync(CancellationToken cancellationToken); Task PublishAsync(CancellationToken cancellationToken);

View file

@ -22,8 +22,6 @@ namespace NucuCar.Domain.Telemetry
public abstract Task StartAsync(); public abstract Task StartAsync();
public abstract bool Publish(int timeout); public abstract bool Publish(int timeout);
public abstract Task PublishAsync(CancellationToken cancellationToken); public abstract Task PublishAsync(CancellationToken cancellationToken);
public abstract void Configure(Dictionary<string, object> config);
public bool RegisterTelemeter(ITelemeter t) public bool RegisterTelemeter(ITelemeter t)
{ {
if (RegisteredTelemeters.Contains(t)) return false; if (RegisteredTelemeters.Contains(t)) return false;

View file

@ -29,10 +29,6 @@ namespace NucuCar.Domain.Telemetry
} }
Logger.LogInformation("Started the AzureTelemetryPublisher!"); Logger.LogInformation("Started the AzureTelemetryPublisher!");
} }
public override void Configure(Dictionary<string, object> config)
{
ConnectionString = config.GetValueOrDefault("AzureIotHubConnectionString").ToString();
}
public override async Task PublishAsync(CancellationToken cancellationToken) public override async Task PublishAsync(CancellationToken cancellationToken)
{ {

View file

@ -34,11 +34,9 @@ namespace NucuCar.Sensors.Telemetry
using var telemetryService = TelemetryPublisher.Instance; using var telemetryService = TelemetryPublisher.Instance;
telemetryService.Logger = _logger; telemetryService.Logger = _logger;
telemetryService.Configure(new Dictionary<string, object>() telemetryService.ConnectionString = _azureIotHubConnectionString;
{ telemetryService.TelemetrySource = "NucuCar.Sensors";
["AzureIotHubConnectionString"] = _azureIotHubConnectionString
});
telemetryService.Start(); telemetryService.Start();
while (!stoppingToken.IsCancellationRequested) while (!stoppingToken.IsCancellationRequested)
{ {