test2.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 } 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 streamService = new StreamingService()
  11. /* -------------- TEST -------------------- */
  12. // change payload into Observable<BaseMessage>
  13. const payload: Observable<BaseMessage> = streamService.stream().pipe(
  14. map(dataSet => ({
  15. header: dataSet.appLogLocId,
  16. data: dataSet
  17. }))
  18. );
  19. const payload2: Observable<string> = streamService.stream().pipe(
  20. map(
  21. data => data.appData.msgId
  22. )
  23. )
  24. // Configure Log Setting
  25. let storage: LogSetting = {
  26. storage: "MongoDB",
  27. setting: {
  28. appName: 'Default from client',
  29. appLocName: 'To be generated in client',
  30. logLocName: 'To be generated in client',
  31. },
  32. customSetting: {
  33. server: "localhost:27017",
  34. collection: "logs"
  35. }
  36. }
  37. let dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> } = {
  38. storage: storage.storage,
  39. setting: storage.setting,
  40. customSetting: storage.customSetting,
  41. incomingObservable: payload
  42. }
  43. // incoming.init(dataSet)
  44. syncrhonize.subscribe(payload2)
  45. // acknowledge.init(storage).then(() => {
  46. // acknowledge.subscribe(payload)
  47. // }).catch((e) => console.error(e))