|
@@ -1,5 +1,5 @@
|
|
import { resolve } from "path";
|
|
import { resolve } from "path";
|
|
-import { Observable, of, Subject } from "rxjs";
|
|
|
|
|
|
+import { map, Observable, of, Subject } from "rxjs";
|
|
import { BaseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
|
|
import { BaseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
|
|
import { LoggingService } from "../dependencies/fisloggingservice/services/logging-service";
|
|
import { LoggingService } from "../dependencies/fisloggingservice/services/logging-service";
|
|
import { MessageLog } from "../dependencies/fisloggingservice/type/datatype";
|
|
import { MessageLog } from "../dependencies/fisloggingservice/type/datatype";
|
|
@@ -7,9 +7,9 @@ import { MessageSynchronisationServiceInterface, MessageSynchronisationServiceSe
|
|
|
|
|
|
export class MessageSyncrhonizationService implements MessageSynchronisationServiceInterface {
|
|
export class MessageSyncrhonizationService implements MessageSynchronisationServiceInterface {
|
|
|
|
|
|
- settings: MessageSynchronisationServiceSetting
|
|
|
|
- sourceSrc: LoggingService = new LoggingService()
|
|
|
|
- targetSrc: LoggingService = new LoggingService()
|
|
|
|
|
|
+ private settings: MessageSynchronisationServiceSetting
|
|
|
|
+ private sourceSrc: LoggingService = new LoggingService()
|
|
|
|
+ private targetSrc: LoggingService = new LoggingService()
|
|
|
|
|
|
public async init(settings: MessageSynchronisationServiceSetting): Promise<void> {
|
|
public async init(settings: MessageSynchronisationServiceSetting): Promise<void> {
|
|
this.settings = settings;
|
|
this.settings = settings;
|
|
@@ -33,22 +33,33 @@ export class MessageSyncrhonizationService implements MessageSynchronisationServ
|
|
}
|
|
}
|
|
|
|
|
|
// Incoming obstriger serves as a trigger point to perform another synchronization
|
|
// Incoming obstriger serves as a trigger point to perform another synchronization
|
|
- public subscribe(obsTrigger: Observable<string>): Observable<any> {
|
|
|
|
- let subjectOutput = this.syncrhonize()
|
|
|
|
- this.targetSrc.subscribe(subjectOutput)
|
|
|
|
- subjectOutput.subscribe({
|
|
|
|
- next: missingMsg => console.log(`Synchronizing ${missingMsg.appData.msgId}`)
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- // obs.subscribe({
|
|
|
|
- // next: element => {
|
|
|
|
- // subjectOutput = this.syncrhonize()
|
|
|
|
- // }
|
|
|
|
|
|
+ public subscribe(obsTrigger: Observable<string>): Observable<BaseMessage> {
|
|
|
|
+
|
|
|
|
+ // let subjectOutput = this.syncrhonize()
|
|
|
|
+ // subjectOutput.subscribe({
|
|
|
|
+ // next: missingMsg => console.log(`Synchronizing ${missingMsg.appData.msgId}`)
|
|
// })
|
|
// })
|
|
|
|
|
|
- return subjectOutput.asObservable()
|
|
|
|
|
|
+ let result = this.dataConversion()
|
|
|
|
+ // let result = this.dataConversion()
|
|
|
|
+ // result.subscribe({
|
|
|
|
+ // next: e => console.log(e)
|
|
|
|
+ // })
|
|
|
|
+ return result
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private dataConversion(): Observable<BaseMessage>{
|
|
|
|
+ // let subjectOutput = this.syncrhonize()
|
|
|
|
+ let obsOutput: Observable<BaseMessage> = this.syncrhonize().pipe(
|
|
|
|
+ map((msg: MessageLog) => {
|
|
|
|
+ // console.log(`Converting this ${msg.appData.msgId}`)
|
|
|
|
+ return JSON.parse(<string>msg.appData.msgPayload)
|
|
|
|
+ })
|
|
|
|
+ )
|
|
|
|
+ return obsOutput
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
private syncrhonize(): Subject<any> {
|
|
private syncrhonize(): Subject<any> {
|
|
let subjectOutput = new Subject()
|
|
let subjectOutput = new Subject()
|
|
this.acquireData().then((data: { arr1: MessageLog[], arr2: MessageLog[] }) => {
|
|
this.acquireData().then((data: { arr1: MessageLog[], arr2: MessageLog[] }) => {
|