소스 검색

test4 for synchronization

Enzo 1 년 전
부모
커밋
663885df66

+ 1 - 1
dependencies/log

@@ -1 +1 @@
-Subproject commit 6fb954d3cc0705d5b06cd60e94ca26ae6c5837bd
+Subproject commit 2930c923831f83b9fbe5ac8e5a82d61649745236

+ 3 - 3
services/acknowledgement.service.ts

@@ -1,9 +1,9 @@
 import { AnyObject } from "mongoose";
 import { map, Observable, of, tap } from "rxjs";
 import { Acknowledgemeent, AcknowledgementLogSetting } from "../type/acknowledgement.interface";
-import { BaseMessage, Command, FisCreateMessageUtility, ResponseMessage, Uuid } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting, MessageLog } from "../dependencies/fisloggingservice/type/datatype";
-import { LoggingService } from "../dependencies/fisloggingservice/interface/export";
+import { BaseMessage, Command, FisCreateMessageUtility, ResponseMessage, Uuid } from "../dependencies/msgutil/interface/export";
+import { LogSetting, MessageLog } from "../dependencies/log/type/datatype";
+import { LoggingService } from "../dependencies/log/interface/export";
 
 
 /**

+ 3 - 3
services/incomingMessage.service.ts

@@ -1,8 +1,8 @@
 import { map, Observable, of, tap } from "rxjs";
 import { IncomingMessageServiceInterface } from "../type/datatype";
-import { LoggingService } from "../dependencies/fisloggingservice/interface/export";
-import { BaseMessage, Uuid } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting, MessageLog } from "../dependencies/fisloggingservice/type/datatype";
+import { LoggingService } from "../dependencies/log/interface/export";
+import { LogSetting, MessageLog } from "../dependencies/log/type/datatype";
+import { BaseMessage, Uuid } from "../dependencies/msgutil/interface/export";
 
 /**
  * @deprecated The logging is now supported by the Fis-Logging library.

+ 16 - 31
services/message-auditor.service.ts

@@ -1,8 +1,8 @@
 import { map, Observable, of, Subject } from "rxjs";
 import { ErrorTrigger, MessageAuditorServiceInterface, MessageSynchronisationServiceSetting } from "../type/datatype";
-import { LoggingService } from "../dependencies/fisloggingservice/interface/export";
-import { BaseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { MessageLog } from "../dependencies/fisloggingservice/type/datatype";
+import { LoggingService } from "../dependencies/log/interface/export";
+import { BaseMessage } from "../dependencies/msgutil/interface/export";
+import { MessageLog } from "../dependencies/log/type/datatype";
 
 export class MessageAuditorService implements MessageAuditorServiceInterface {
     private settings: MessageSynchronisationServiceSetting
@@ -20,47 +20,31 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
     target. Essentially, this does not synchronize, but rather it checks against the two sources and compare
     and return the missing data, which will then be passed into the targeted subject stream as specified by the
     respective client. They can choose how they want to handle the missing messages returned. */
-    public subscribe(obsTrigger: Observable<ErrorTrigger>): Observable<BaseMessage> {
+    public subscribe(obsTrigger: Observable<ErrorTrigger>): Observable<MessageLog> {
         // Create a subject as a means to return the missing messages if there's any.
-        let msg: Subject<BaseMessage> = new Subject()
+        let msg: Subject<MessageLog> = new Subject()
 
         // Subsribe to the errorTrigger obs to listen to any notification.
         obsTrigger.subscribe({
             next: obsTrigger => {
                 console.log(obsTrigger.message)// just checking the message
 
-                let missingMsg = this.dataConversion()
+                let missingMsg : Observable<MessageLog> = this.synchronize()
                 missingMsg.subscribe({
                     next: element => {
                         msg.next(element)
-                        console.log(`Synchronizing ${element.header.messageID} ....`)
+                        console.log(`Synchronizing ${element.appData.msgId} ....`)
                     }
                 })
-                this.targetSrc.init(this.settings.target).then(() => {
-                    this.targetSrc.subscribe(msg)
-                })
             }
         })
-        let result: Observable<BaseMessage> = msg.asObservable()
+        let result: Observable<MessageLog> = msg.asObservable()
         return result
     }
 
-    // Need to change the data to json format first
-    private dataConversion(): Observable<BaseMessage> {
-        // let subjectOutput = this.syncrhonize()
-        let obsOutput: Observable<BaseMessage> = this.synchronize().pipe(
-            map((msg: MessageLog) => {
-                console.log(`PROCESSING this ${msg.appData.msgId}`)
-                return JSON.parse(<string>msg.appData.msgPayload)
-            })
-        )
-        return obsOutput
-    }
-
-
     /* This is where the 'synching' operation takes place. */
-    private synchronize(): Subject<any> {
-        let subjectOutput = new Subject()
+    private synchronize(): Subject<MessageLog> {
+        let subjectOutput : Subject<MessageLog> = new Subject()
         // Acquire the data from both location and return them as an array respectively.
         this.acquireData().then((data: { arr1: MessageLog[], arr2: MessageLog[] }) => {
             // Check for length first. If the length matches, then there's no need to sync
@@ -72,9 +56,10 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
                 // will be carried out to filter out the differences. Differences are the missing data.
                 this.checkArrayDifferences(data).then((data: MessageLog[]) => {
                     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 
                         // to be returned for the subscribe method.
-                        subjectOutput.next(msgElement)
+                        subjectOutput.next(refined)
                     })
                 })
             }
@@ -93,15 +78,15 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
                 arr1: [],
                 arr2: []
             }
-            let set1
-            let set2
+            let set1 : MessageLog[]
+            let set2 : MessageLog[]
 
             // Initiate the source to find the location of the targeted data to be synched.
             this.sourceSrc.init(this.settings.incomingSource).then(() => {
                 this.targetSrc.init(this.settings.target).then(() => {
                     // Filter also carries out the query aspect of the operation, allowing it to acquire all the relevant data.
                     this.sourceSrc.filter({ msgTag: this.settings.incomingSource.tags[0] }).then((data: MessageLog[]) => {
-                        set1 = data
+                        set1 = data 
                     }).then(() => {
                         this.targetSrc.filter({ msgTag: this.settings.target.tags[0] }).then((data: MessageLog[]) => {
                             set2 = data
@@ -117,7 +102,7 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
     }
 
     // compare results and return differences
-    private async checkArrayDifferences(args: { arr1?: any[], arr2?: any[] }): Promise<any[]> {
+    private async checkArrayDifferences(args: { arr1?: any[], arr2?: any[] }): Promise<MessageLog[]> {
         return new Promise((resolve, reject) => {
             let missingMsg: MessageLog[] = []
             args.arr1.forEach((msgElement: MessageLog) => {

+ 1 - 1
test/test-streamOBS.ts

@@ -3,7 +3,7 @@
 
 import { from, map, Observable, of, Subject } from "rxjs";
 import * as fs from "fs"
-import { BaseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
+import { BaseMessage } from "../dependencies/msgutil/interface/export";
 
 export class StreamingService {
     private messagesJSON: any = fs.readFileSync("testRequest.json")

+ 2 - 2
test/test1a.ts

@@ -3,8 +3,8 @@ import { StreamingService } from "./test-streamOBS";
 import { MessageAuditorService } from "../services/message-auditor.service";
 import { IncomingMessageService } from "../services/incomingMessage.service";
 import { map, Observable } from "rxjs";
-import { BaseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
+import { BaseMessage } from "../dependencies/msgutil/interface/export";
+import { LogSetting } from "../dependencies/log/type/datatype";
 const incoming = new IncomingMessageService()
 const acknowledge = new AcknowledgementService()
 const syncrhonize = new MessageAuditorService()

+ 2 - 2
test/test1b.ts

@@ -3,8 +3,8 @@ import { StreamingService } from "./test-streamOBS";
 import { MessageAuditorService } from "../services/message-auditor.service";
 import { IncomingMessageService } from "../services/incomingMessage.service";
 import { map, Observable } from "rxjs";
-import { BaseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
+import { BaseMessage } from "../dependencies/msgutil/interface/export";
+import { LogSetting } from "../dependencies/log/type/datatype";
 
 const incoming = new IncomingMessageService()
 const acknowledge = new AcknowledgementService()

+ 2 - 2
test/test2a.ts

@@ -3,8 +3,8 @@ import { StreamingService } from "./test-streamOBS";
 import { MessageAuditorService } from "../services/message-auditor.service";
 import { IncomingMessageService } from "../services/incomingMessage.service";
 import { map, Observable, take } from "rxjs";
-import { BaseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
+import { BaseMessage } from "../dependencies/msgutil/interface/export";
+import { LogSetting } from "../dependencies/log/type/datatype";
 const incoming = new IncomingMessageService()
 const syncrhonize = new MessageAuditorService()
 const acknowledge = new AcknowledgementService()

+ 2 - 2
test/test2b.ts

@@ -3,8 +3,8 @@ import { StreamingService } from "./test-streamOBS";
 import { MessageAuditorService } from "../services/message-auditor.service";
 import { IncomingMessageService } from "../services/incomingMessage.service";
 import { map, Observable, take } from "rxjs";
-import { BaseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
+import { BaseMessage } from "../dependencies/msgutil/interface/export";
+import { LogSetting } from "../dependencies/log/type/datatype";
 const incoming = new IncomingMessageService()
 const syncrhonize = new MessageAuditorService()
 const acknowledge = new AcknowledgementService()

+ 7 - 5
test/test3a.ts

@@ -8,8 +8,8 @@ import { IncomingMessageService } from "../services/incomingMessage.service";
 import { MessageAuditorService } from "../services/message-auditor.service";
 import { ErrorTrigger, MessageSynchronisationServiceSetting } from "../type/datatype";
 import { StreamingService } from "./test-streamOBS";
-import { BaseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
+import { BaseMessage } from "../dependencies/msgutil/interface/export";
+import { LogSetting } from "../dependencies/log/type/datatype";
 
 /* Pre - Defined Data && Settings */
 const stream = new StreamingService()
@@ -121,9 +121,11 @@ setTimeout(() => {
 
     let sync = source_synchronize.subscribe(triggerSync)
     sync.subscribe({
-        next: (msgToBeSynched) => {
-            // console.log(`synching ... ${msgToBeSynched.header.messageID}`)
-            target_payload_subject.next(msgToBeSynched)
+        next: (msgToBeSynchronized) => {
+            let raw = msgToBeSynchronized.appData.msgPayload
+            let data: BaseMessage = JSON.parse(<string>raw)
+            // console.log(`synching ... ${msgToBeSynchronized.header.messageID}`)
+            target_payload_subject.next(data)
         }
     })
 

+ 7 - 5
test/test3b.ts

@@ -9,8 +9,8 @@ import { IncomingMessageService } from "../services/incomingMessage.service";
 import { MessageAuditorService } from "../services/message-auditor.service";
 import { ErrorTrigger, MessageSynchronisationServiceSetting } from "../type/datatype";
 import { StreamingService } from "./test-streamOBS";
-import { BaseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
+import { BaseMessage } from "../dependencies/msgutil/interface/export";
+import { LogSetting, MessageLog } from "../dependencies/log/type/datatype";
 
 /* Pre - Defined Data && Settings */
 const stream = new StreamingService()
@@ -128,9 +128,11 @@ setTimeout(() => {
 
     let sync = source_synchronize.subscribe(triggerSync)
     sync.subscribe({
-        next: (msgToBeSynched) => {
-            // console.log(`synching ... ${msgToBeSynched.header.messageID}`)
-            source_payload_subject.next(msgToBeSynched)
+        next: (msgToBeSynchronized) => {
+            let raw = msgToBeSynchronized.appData.msgPayload
+            let data: BaseMessage = JSON.parse(<string>raw)
+            // console.log(`synching ... ${msgToBeSynchronized.header.messageID}`)
+            source_payload_subject.next(data)
         }
     })
 

+ 12 - 12
test/test3c.ts

@@ -7,9 +7,9 @@ import { Observable, map, Subject, takeUntil, take, of, timer, from } from "rxjs
 import { ErrorTrigger, MessageSynchronisationServiceSetting } from "../type/datatype";
 import { StreamingService } from "./test-streamOBS";
 import { MessageAuditorService } from "../services/message-auditor.service";
-import { LoggingService } from "../dependencies/fisloggingservice/interface/export";
-import { BaseMessage, ResponseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
+import { BaseMessage, ResponseMessage } from "../dependencies/msgutil/interface/export";
+import { LoggingService } from "../dependencies/log/interface/export";
+import { LogSetting, MessageLog } from "../dependencies/log/type/datatype";
 
 /* Pre - Defined Data && Settings */
 // This service will stream the messages from the local testRequest.json messages
@@ -45,9 +45,7 @@ subscriber.subscribe((e) => {
 subscriber_take_two_messagse.subscribe({
     next: (data) => {
         subscriber.next(<ResponseMessage>data)
-    },
-    error: e => console.error(e),
-    complete: () => { `Target Payload Completed` }
+    }
 })
 
 
@@ -65,7 +63,7 @@ let publisher_storage: LogSetting = {
     },
     customSetting: {
         server: "192.168.100.59:27017",
-        database: "primary"
+        database: "test"
     }
 }
 
@@ -86,7 +84,7 @@ let subscriber_storage: LogSetting = {
         user: "testDB",
         password: "h1nt1OyXw6QeUnzS",
         server: "cluster0.29sklte.mongodb.net",
-        database: "secondary",
+        database: "test",
     }
 }
 
@@ -117,7 +115,7 @@ function initializeData() { // To store the data into the designated databases.
 }
 
 // Done by appoximately 5-8 Seconds
-// initializeData() // Call the function to store the data into the designated databases.
+initializeData() // Call the function to store the data into the designated databases.
 publisher_sync.init(settings)
 
 /* This is where the synchronization logic is called. The errorSubject will act as a trigger
@@ -126,10 +124,12 @@ let errorSubject: Subject<ErrorTrigger> = new Subject()
 // Subscribe to errorSubject notification 
 let sync = publisher_sync.subscribe(errorSubject)
 sync.subscribe({
-    next: (msgToBeSynchronized) => {
-        console.log(`passing missing message: ${msgToBeSynchronized.header.messageID} into target/secondary subject.`)
+    next: (msgToBeSynchronized: MessageLog) => {
+        console.log(`passing missing message: ${msgToBeSynchronized.appData.msgId} into target/secondary subject.`)
         // the missing data returned will be pushed (next(message)) into the target payload.
-        subscriber.next(msgToBeSynchronized)
+        let raw = msgToBeSynchronized.appData.msgPayload
+        let data : BaseMessage = JSON.parse(<string>raw)
+        subscriber.next(data)
     }
 })
 

+ 91 - 85
test/test4.ts

@@ -1,45 +1,91 @@
 /*  -----------------------       TEST4 {Mongo to Mongo}    -----------------------   */
-/* Same with test 3 but this one will be working with CDMS or any other potential data. */
+/* Same with test 3 but this one it will be working with CDMS or any other potential data.
+Highly advisable to refer to test3c for the overall explanation of the logic flow in these
+test cases. Test4 is an adjusted version of test3 to cater for the need to deal with 
+different types of data aside from messageLogs. */
 import * as mongoose from 'mongoose'
 import { Observable, map, Subject, takeUntil, take, of, timer, from } from "rxjs";
 import { ErrorTrigger, MessageSynchronisationServiceSetting } from "../type/datatype";
 import { StreamingService } from "./test-streamOBS";
 import { MessageAuditorService } from "../services/message-auditor.service";
-import { LoggingService } from "../dependencies/fisloggingservice/interface/export";
-import { BaseMessage, ResponseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
-
-/* Pre - Defined Data && Settings */
-// This service will stream the messages from the local testRequest.json messages
-// into the designated location that will be specified later.
-const stream = new StreamingService()
-
-/* Using the instance of the streaming declared earlier, we feed 4 messages into the
-subscribers that are going to subsscribe to this source_payload. Please note that 
-source_payload will emite the messages stream from the instance of stream service
-and further feed them into the other Subject which is called source_payload_subject. */
+import { LoggingService } from '../dependencies/log/interface/export';
+import { BaseMessage } from '../dependencies/msgutil/interface/export';
+import { LogSetting, MessageLog } from '../dependencies/log/type/datatype';
+import * as fs from "fs"
+
+/* Convert all the non message data in the database into messageLog type. This is to ensure it's compatibility 
+to be used by the interface from logging and audit message features. */
+const Schema = mongoose.Schema;
+// Create the fingerprint schema. This is the type of the data to be transformed into messageLog type
+const fingerPrintSchema = new Schema({
+    uuid: { type: String, required: true, lowercase: true, unique: true },
+    fileName: { type: String, required: true, lowercase: true },
+    fileType: { type: String, required: true, lowercase: true },
+    entityName: { type: String, required: true, lowercase: true },
+    fileData: { type: Object, required: true },
+});
+
+// Use existing schema. 
+const messageSchema = require('../dependencies/log/type/schemas/message.schema')
+
+function convertDataInMongo(url: string) {
+    // Create a subject to stream data received from query at mongo
+    let data: Subject<any> = new Subject()
+    let convertService = new LoggingService()
+
+    let dbConnection = mongoose.createConnection(url)
+    let dataModel = dbConnection.model('genericdata', fingerPrintSchema)
+    let messages = dbConnection.model('message', messageSchema)
+    
+    // Once the data is queried, it will be streamed into the data Subject declared earlier
+    dataModel.find().then((res) => {
+        // console.log(res)
+        res.forEach((element) => {
+            data.next(element)
+        })
+    })
+    
+    // Assign a `handler` so to speak to handle the element receivd in the data Subject
+    // This is where the transformation happens. The logic is written on the logging service side.
+    // Once that is done, the transformed data will be saved again bacn in the mongo database in a different databse/collection
+    data.subscribe((element) => {
+        let res = convertService.convertCDMStoMessageLog(element, settings.incomingSource.tags)
+        console.log(`Converting fingerprint .... ${res.appData.msgId}`)
+        messages.create(res)
+    })
+}
+
+let dbConnection = mongoose.createConnection("mongodb+srv://testDB:h1nt1OyXw6QeUnzS@cluster0.29sklte.mongodb.net/secondary")
+let dataModel = dbConnection.model('genericdata', fingerPrintSchema)
+
+function convertMessageLogToCDMS(args: MessageLog){
+    let converted = secondary_log.convertMessageLogtoCDMS(args)
+    dataModel.create(converted)
+}
+
+
+/* For basic explanation, pleas refer to test3c. Here we are just instantiating audit and logging service for both
+the primary and the secondary soures. And then the instantiation of the corresponding subjects. 
+The idea is that the subject will receive the missing info provided by the auditor and then log the 
+missing data in the designated database location.
+ */
 const primary_sync = new MessageAuditorService()
 const primary_Log = new LoggingService()
-const primary: Subject<BaseMessage> = new Subject()
-primary.subscribe((e) => {
-    console.log(`Primary Received ${e.header.messageID}`)
+const primary: Subject<MessageLog> = new Subject()
+primary.subscribe((element) => {
+    console.log(`Primary Received ${element.appData.msgId}`)
 })
 
-/* Same thing as the above. The only difference is the we feed only 2 messages 
-to simulate streaming error. We want to see if it will sync the other 2 later 
-on. But generall the declarative structure is the same as the above. */
 const secondary_log = new LoggingService()
-const secondary: Subject<BaseMessage> = new Subject()
-secondary.subscribe((e) => {
-    console.log(`Secondary Received ${e.header.messageID}`)
+const secondary: Subject<MessageLog> = new Subject()
+secondary.subscribe((element: MessageLog) => {
+    console.log(`Secondary Received ${element.appData.msgId}`)
+    convertMessageLogToCDMS(element)
 })
 
 
-/* Declare the designated database. I am using windev's mongo storage to store the data.
-Hence here, is the block that definte the target and it's associated specifications.
-This will be the target and will receive the predefined set of data to be logged as 
-prepared earlier in the code above.s */
-let publisher_storage: LogSetting = {
+/* For basic explanation, please refer to test3c. Declaration of the source and target location. */
+let primary_storage: LogSetting = {
     cacheMessageLimit: 0,
     storage: "MongoDB",
     setting: {
@@ -53,11 +99,7 @@ let publisher_storage: LogSetting = {
     }
 }
 
-/* Same as above. Also declaring another designated database. But this one will be used
-as the target for synching. For such I purposely push only half the of the completed 
-dataset in order to test out the sync later. I am using my own cloud atlas mongo
-database on this. The address can always be changed. */
-let subscriber_storage: LogSetting = {
+let secondary_storage: LogSetting = {
     cacheMessageLimit: 0,
     storage: "MongoDB",
     setting: {
@@ -74,34 +116,22 @@ let subscriber_storage: LogSetting = {
     }
 }
 
-// Combine source and target storage to form MessageSynchronisationServiceSetting
+// Combine source and target storage to form MessageSynchronisationServiceSetting. This is required in messageAudit initialization
 let settings: MessageSynchronisationServiceSetting = {
     incomingSource: {
         //all of the settings to be combined here
-        ...publisher_storage,
-        tags: ['Incoming']
+        ...primary_storage,
+        tags: ['Fingerprint']
     }, //LogSetting & {tags:string[] },   
     target: {
-        ...subscriber_storage,
-        tags: ['Incoming']
+        ...secondary_storage,
+        tags: ['Fingerprint']
     }  //LogSetting & {tags:string[] }  
 }
+ 
 
 /* -------- SYNCHRONIZATION --------- */
-// This is where the real test begin. THe process before this were merely just configuring 
-// the settings of where to sync. Here the initial intialize data will first log the 
-// messages into the designated database as specified earlier.
-function initializeData() { // To store the data into the designated databases.
-    primary_Log.init(publisher_storage).then(() => {
-        primary_Log.subscribe(primary) // Logging only occurs here
-    })
-    secondary_log.init(subscriber_storage).then(() => {
-        secondary_log.subscribe(secondary) // Logging only occurs here
-    })
-}
-
-// Done by appoximately 5-8 Seconds
-// initializeData() // Call the function to store the data into the designated databases.
+// Primary will call the syncrhonization service
 primary_sync.init(settings)
 
 /* This is where the synchronization logic is called. The errorSubject will act as a trigger
@@ -110,15 +140,13 @@ let errorSubject: Subject<ErrorTrigger> = new Subject()
 // Subscribe to errorSubject notification 
 let sync = primary_sync.subscribe(errorSubject)
 sync.subscribe({
-    next: (msgToBeSynchronized) => {
-        console.log(`passing missing message: ${msgToBeSynchronized.header.messageID} into target/secondary subject.`)
+    next: (msgToBeSynchronized: MessageLog) => {
+        console.log(`passing missing message: ${msgToBeSynchronized.appData.msgId} into target/secondary subject.`)
         // the missing data returned will be pushed (next(message)) into the target payload.
         secondary.next(msgToBeSynchronized)
     }
 })
 
-
-
 // Set time oout for 5 seconds to allow the initial logging stage to complete it's logging
 // implementation first before proceedint to trigger the sync
 setTimeout(() => {
@@ -129,7 +157,7 @@ setTimeout(() => {
         message: "NO. I dont want to work"
     }
     errorSubject.next(sampleError)
-}, 10000)
+}, 3000)
 
 /* THis is testing for generating error message to be fed into the error subject
 to act as additional trigger to exectute the synchronization when there's no internet
@@ -176,33 +204,11 @@ function countdown() {
 
 countdown()
 
+// convertDataInMongo('mongodb://192.168.100.59:27017/primary')
+// convertDataInMongo('mongodb+srv://testDB:h1nt1OyXw6QeUnzS@cluster0.29sklte.mongodb.net/secondary')
 
-const Schema = mongoose.Schema;
-const fingerPrintSchema = new Schema({
-    uuid: { type: String, required: true, lowercase: true, unique: true },
-    fileName: { type: String, required: true, lowercase: true },
-    fileType: { type: String, required: true, lowercase: true },
-    entityName: { type: String, required: true, lowercase: true },
-    fileData: { type: Object, required: true },
-});
-
-function convertDataInMongo(url: string) {
-    let data: Subject<any> = new Subject()
-    let convertService = new LoggingService()
-
-    let dbConnection = mongoose.createConnection(url)
-    let dataModel = dbConnection.model('genericdata', fingerPrintSchema)
-    dataModel.find().then((res) => {
-        // console.log(res)
-        res.forEach((element) => {
-            data.next(element)
-        })
-    })
-
-    data.subscribe((element) => {
-        convertService.
-    })
-}
+// // Manually log the missing data given by audit
+secondary_log.init(settings.target).then(() => {
+    secondary_log.subscribe(secondary) 
+})
 
-convertDataInMongo('mongodb+srv://testDB:h1nt1OyXw6QeUnzS@cluster0.29sklte.mongodb.net/test')
-convertDataInMongo('mongodb://192.168.100.59:27017/hq')

+ 2 - 2
type/acknowledgement.interface.ts

@@ -1,6 +1,6 @@
 import { Observable } from "rxjs";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
-import { BaseMessage, ResponseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
+import { BaseMessage, ResponseMessage } from "../dependencies/msgutil/interface/export";
+import { LogSetting } from "../dependencies/log/type/datatype";
 
 /**
  * @deprecated The acknowledgement will be covered by MessageAuditorService.

+ 2 - 2
type/datatype.ts

@@ -1,6 +1,6 @@
 import { Observable } from "rxjs";
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
-import { BaseMessage } from "../dependencies/fisappmessagejsutilty/interface/export";
+import { BaseMessage } from "../dependencies/msgutil/interface/export";
+import { LogSetting } from "../dependencies/log/type/datatype";
 
 type IncomingMessageSetting = LogSetting & {
     incomingObservable: Observable<BaseMessage>