import { Observable, Subject } from "rxjs"; import { BaseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies"; import { LoggingService } from "../dependencies/fisloggingservice/services/logging-service"; import { MessageSynchronisationServiceInterface, MessageSynchronisationServiceSetting } from "../type/datatype"; export class MessageSyncrhonizationService implements MessageSynchronisationServiceInterface { settings:MessageSynchronisationServiceSetting sourceSrc:LoggingService = new LoggingService() targetSrc:LoggingService = new LoggingService() public async init(settings: MessageSynchronisationServiceSetting): Promise { console.log(settings) this.settings = settings; this.sourceSrc.init(settings.incomingSource); this.targetSrc.init(settings.target); } public subscribe(obs: Observable): Observable { let returnObs:Subject = new Subject(); // filter all source tags[0] log data // this.logSrv1.filter( // this.settings.incomingSource.tags[0] // ) = set1 // filter all target tags[0] log data // this.logSrv2.filter( // this.settings.target.tags[0] // ) = set2 // Compare set1 and set2 // >> found missing message "4" // Send missing messages "4" ( in a loop) //returnObs.next(message "4") obs.subscribe( { next:(data)=>{ // filter all source tags[0] log data // this.logSrv1.filter( // this.settings.incomingSource.tags[0] // ) = set1 // filter all target tags[0] log data // this.logSrv2.filter( // this.settings.target.tags[0] // ) = set2 // Compare set1 and set2 // >> found missing message "5x" // Send missing messages "5x" ( in a loop) //returnObs.next(message "5x") } } ) console.log(obs) return } }