public async Task <string> GetMessageAsync(string deviceId, string moduleId) { string logPrefix = "SimpleErrorMessageService".BuildLogPrefix(); string artifactId = string.IsNullOrEmpty(moduleId) ? deviceId : moduleId; string messageString = await GetMessageAsync(); _logger.LogTrace($"{logPrefix}::{artifactId}::error.json file loaded."); messageString = IoTTools.UpdateIds(messageString, deviceId, moduleId); _logger.LogTrace($"{logPrefix}::{artifactId}::DeviceId and moduleId updated in the message template."); return(messageString); }
public async Task <string> GetMessageAsync(string deviceId, string moduleId) { string artifactId = string.IsNullOrEmpty(moduleId) ? deviceId : moduleId; string logPrefix = "SimpleTelemetryMessageService".BuildLogPrefix(); string messageString = await GetMessageAsync(); if (string.IsNullOrEmpty(messageString)) { throw new ArgumentNullException(nameof(messageString), "DATA: The message to send is empty or not found."); } _logger.LogTrace($"{logPrefix}::{artifactId}::measureddata.json file loaded."); messageString = IoTTools.UpdateIds(messageString, deviceId, moduleId); _logger.LogTrace($"{logPrefix}::{artifactId}::DeviceId and moduleId updated in the message template."); return(messageString); }