test2b.ts 1.6 KB

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