test2b.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { AcknowledgementService } from "../services/acknowledgement.service";
  2. import { StreamingService } from "./test-streamOBS";
  3. import { map, Observable, take } from "rxjs";
  4. import { LogSetting } from "../dependencies/log/type/datatype";
  5. import { BaseMessage } from "../dependencies/log/dependencies/msgutil/interface/export";
  6. const acknowledge = new AcknowledgementService()
  7. const streamService = new StreamingService()
  8. /* -------------- TEST -------------------- */
  9. // change payload into Observable<BaseMessage>
  10. const payload: Observable<BaseMessage> = streamService.stream().pipe(take(3));
  11. // Configure Log Setting
  12. let storage: LogSetting = {
  13. storage: "MongoDB",
  14. cacheMessageLimit: 0,
  15. setting: {
  16. appName: 'Default from client',
  17. appLocName: 'To be generated in client',
  18. logLocName: 'To be generated in client',
  19. },
  20. customSetting: {
  21. srv: true,
  22. user: "testDB",
  23. password: "h1nt1OyXw6QeUnzS",
  24. server: "cluster0.29sklte.mongodb.net",
  25. database: "log",
  26. }
  27. }
  28. let dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> } = {
  29. storage: storage.storage,
  30. setting: storage.setting,
  31. customSetting: storage.customSetting,
  32. incomingObservable: payload
  33. }
  34. acknowledge.init(storage).then(() => {
  35. acknowledge.subscribe(dataSet.incomingObservable)
  36. })