1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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<void> {
- console.log(settings)
- this.settings = settings;
- this.sourceSrc.init(settings.incomingSource);
- this.targetSrc.init(settings.target);
- }
- public subscribe(obs: Observable<string>): Observable<any> {
- let returnObs:Subject<BaseMessage> = 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
- }
- }
|