|
@@ -1,14 +1,12 @@
|
|
|
-import { Observable, of, take } from "rxjs";
|
|
|
+import { map, Observable, of, take } from "rxjs";
|
|
|
import * as fs from "fs"
|
|
|
-import { LoggingService } from "../dependencies/fisloggingservice/services/logging-service";
|
|
|
import { AcknowledgementService } from "../services/acknowledgemeent.service";
|
|
|
import { StreamingService } from "./stream";
|
|
|
import { SyncrhonizationService } from "../services/synchronization.service";
|
|
|
import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
|
|
|
const acknowledge = new AcknowledgementService()
|
|
|
const syncrhonize = new SyncrhonizationService()
|
|
|
-const log = new LoggingService()
|
|
|
-const stream = new StreamingService()
|
|
|
+const streamService = new StreamingService()
|
|
|
|
|
|
// Configure Log Setting
|
|
|
const storage: LogSetting = {
|
|
@@ -20,25 +18,12 @@ const storage: LogSetting = {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-console.log(`I am Client 1`)
|
|
|
-acknowledge.acknowledge()
|
|
|
-syncrhonize.synchronize()
|
|
|
+// console.log(`I am Client 1`)
|
|
|
+// syncrhonize.synchronize()
|
|
|
|
|
|
-stream.stream().subscribe(data => {
|
|
|
- // console.log(data)
|
|
|
- let chainStream = of(data)
|
|
|
- chainStream.subscribe(
|
|
|
- // value => console.log(value),
|
|
|
- error => console.error(error),
|
|
|
- // () => console.log('Streaming completed')
|
|
|
- );
|
|
|
- log.init(storage).then(() => {
|
|
|
- log.subscribe(data).then(() => {
|
|
|
- log.filter({ msgId: "44f701a9-8ba7-4e07-bd66-f84db12ae481" }).catch(() => console.log(`Failed to resolve filter`))
|
|
|
- }).catch(() => console.log(`Failed to resolve stream data`))
|
|
|
-
|
|
|
- }).catch(() => console.log(`Failed to resolve init`))
|
|
|
-},
|
|
|
- error => console.error(error),
|
|
|
- () => console.log('Streaming completed')
|
|
|
-)
|
|
|
+/* -------------- ACTION -------------------- */
|
|
|
+const payload = streamService.stream()
|
|
|
+
|
|
|
+acknowledge.init(storage).then(() => {
|
|
|
+ acknowledge.subscribe(payload)
|
|
|
+}).catch((e) => console.error(e))
|