public bool SaveToDB(string fileKey, IList <Compensation> compensations)
        {
            //Add to Kibana log
            if (!compensations.Any())
            {
                _logger.LogCritical("RPSDBProcessManager : SaveToDB. No compensation data to save for file {0}", fileKey);
                return(false);
            }

            _logger.LogInformation("RPSDBProcessManager SaveToDB for key: {0} complete. Number of Records: {1}, Generate Output: {2}"
                                   , fileKey, compensations.Count, Compensation.GetCompensationsAsString(compensations, false));
            //TODO :
            //  1. Depending on sql call as well as async/sync operation, reconsider return value.
            //     right now it is just a pass through.
            // 2. Call SP based on table param(or any other) that sp expect.
            return(true);
        }
示例#2
0
        private async Task<bool> handleMessage(string key, string message)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(message) || String.IsNullOrWhiteSpace(key))
                {
                    _logger.LogCritical("Invalid input received by output manager: {0} : {1}", key, message);
                    return false;
                }
                var compensations = getCompensationList(message);
                _RPSDBProcessManager.SaveToDB(key, compensations);
                _logger.LogInformation("ProcessOutput for key: {0} complete. Number of Records: {1}, Generate Output: {2}", key, compensations?.Count, Compensation.GetCompensationsAsString(compensations));
                return true;
            }
            catch (Exception ex)
            {
                _logger.LogCritical("Message is not valid!: {0}. Exception : {1}", message, ex);
            }

            return false;
        }