test.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { Observable, of, take } from "rxjs";
  2. import * as fs from "fs"
  3. import { LoggingService } from "../dependencies/fisloggingservice/services/logging-service";
  4. import { AcknowledgementService } from "../services/acknowledgemeent.service";
  5. import { StreamingService } from "./stream";
  6. import { SyncrhonizationService } from "../services/synchronization.service";
  7. import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
  8. const acknowledge = new AcknowledgementService()
  9. const syncrhonize = new SyncrhonizationService()
  10. const log = new LoggingService()
  11. const stream = new StreamingService()
  12. // Configure Log Setting
  13. const storage: LogSetting = {
  14. storage: "File",
  15. setting: {
  16. appName: 'Default from client',
  17. appLocName: 'To be generated in client',
  18. logLocName: 'To be generated in client',
  19. }
  20. }
  21. console.log(`I am Client 1`)
  22. acknowledge.acknowledge()
  23. syncrhonize.synchronize()
  24. stream.stream().subscribe(data => {
  25. // console.log(data)
  26. let chainStream = of(data)
  27. chainStream.subscribe(
  28. // value => console.log(value),
  29. error => console.error(error),
  30. // () => console.log('Streaming completed')
  31. );
  32. log.init(storage).then(() => {
  33. log.subscribe(data).then(() => {
  34. log.filter({ msgId: "44f701a9-8ba7-4e07-bd66-f84db12ae481" }).catch(() => console.log(`Failed to resolve filter`))
  35. }).catch(() => console.log(`Failed to resolve stream data`))
  36. }).catch(() => console.log(`Failed to resolve init`))
  37. },
  38. error => console.error(error),
  39. () => console.log('Streaming completed')
  40. )