test2.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { AcknowledgementService } from "../services/acknowledgement.service";
  2. import { StreamingService } from "./test-streamOBS";
  3. import { MessageSyncrhonizationService } from "../services/synchronization.service";
  4. import { IncomingMessageService } from "../services/incomingMessage.service";
  5. import { map, Observable, take } from "rxjs";
  6. import { LogSetting, MessageLog } from "../dependencies/fisloggingservice/type/datatype";
  7. import { BaseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
  8. const incoming = new IncomingMessageService()
  9. const syncrhonize = new MessageSyncrhonizationService()
  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. setting: {
  19. appName: 'Default from client',
  20. appLocName: 'To be generated in client',
  21. logLocName: 'To be generated in client',
  22. },
  23. customSetting: {
  24. srv: true,
  25. user: "testDB",
  26. password: "h1nt1OyXw6QeUnzS",
  27. server: "cluster0.29sklte.mongodb.net",
  28. collection: "log",
  29. }
  30. }
  31. let dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> } = {
  32. storage: storage.storage,
  33. setting: storage.setting,
  34. customSetting: storage.customSetting,
  35. incomingObservable: payload
  36. }
  37. incoming.init(dataSet)
  38. // acknowledge.init(storage).then(() => {
  39. // acknowledge.subscribe(dataSet.incomingObservable)
  40. // })