|
@@ -5,6 +5,8 @@ import * as _ from 'lodash'
|
|
|
import { LoggingService } from "../dependencies/log/interface/export";
|
|
|
import { BaseMessage } from "../dependencies/log/dependencies/msgutil/interface/export";
|
|
|
let processedMsgIds = new Set();
|
|
|
+require('dotenv').config();
|
|
|
+
|
|
|
export class MessageAuditorService implements MessageAuditorServiceInterface {
|
|
|
private settings: MessageSynchronisationServiceSetting
|
|
|
private sourceSrc: LoggingService = new LoggingService()
|
|
@@ -90,6 +92,13 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
|
|
|
// In the case where there are differences in the array length, then extensive comparison
|
|
|
// will be carried out to filters out the differences. Differences are the missing data.
|
|
|
|
|
|
+ if(process.env.CheckAudit)
|
|
|
+ {
|
|
|
+ console.log("Record set 1: ", _.keys(_.countBy(data.arr1,function(data:MessageLog){return data.appData['msgId']})).length);
|
|
|
+ console.log("Record set 2: ", _.keys(_.countBy(data.arr2,function(data:MessageLog){return data.appData['msgId']})).length);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if(process.env.CheckAudit)
|
|
|
{
|
|
|
console.log("[CheckAudit] Record set 1: ", _.keys(_.countBy(data.arr1,function(data:MessageLog){return data.appData['msgId']})).length);
|
|
@@ -100,17 +109,9 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
|
|
|
|
|
|
if(process.env.CheckAudit)
|
|
|
{
|
|
|
- console.log("[CheckAudit] Difference: ", _.keys(_.countBy(data,function(msg:MessageLog){return msg.appData['msgId']})).length);
|
|
|
- console.log("[CheckAudit] Missing msgId: ", _.keys(_.countBy(data, function (msg: MessageLog) { return msg.appData['msgId'] })));
|
|
|
+ console.log("Difference: ",data.length);
|
|
|
}
|
|
|
|
|
|
- // filter out the duplicate record and only emit the first record
|
|
|
- let missingMsgIdArray = _.keys(_.countBy(data, function (msg: MessageLog) { return msg.appData['msgId'] }));
|
|
|
- let uniqueRecords = missingMsgIdArray.map(msgId => {
|
|
|
- let dataForMsgId = data.find(msg => msg.appData['msgId'] === msgId);
|
|
|
- return dataForMsgId;
|
|
|
- });
|
|
|
- data = uniqueRecords;
|
|
|
data.forEach(msgElement => {
|
|
|
let refined = JSON.parse(JSON.stringify(msgElement))
|
|
|
// Once the missing data has been weeded out, it is then passed into the Subject
|