acknowledgemeent.service.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { map, Observable, tap } from "rxjs";
  2. import { ResponseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
  3. import { FisCreateMessageUtility } from "../dependencies/fisappmessagejsutilty/services/fis.create.message";
  4. import { LoggingService } from "../dependencies/fisloggingservice/services/logging-service";
  5. import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
  6. import { Acknowledgemeent } from "../interface/acknowledgement.interface";
  7. export class AcknowledgementService implements Acknowledgemeent {
  8. private messageUtil: FisCreateMessageUtility = new FisCreateMessageUtility("FisAppID/Name")
  9. private settings: LogSetting = {
  10. storage: '',
  11. setting: {
  12. appId: '',
  13. appName: '',
  14. logLocName: '',
  15. logLocId: '',
  16. appLogLocId: '',
  17. appLocName: '',
  18. appLogId: ''
  19. }
  20. }
  21. constructor(private logService?: LoggingService) {
  22. }
  23. // set the data. I dont know what to set yet
  24. public async init(settings: LogSetting) {
  25. // console.log(settings)
  26. this.settings = settings
  27. this.logService.init(this.settings)
  28. // Error Cannot error properties of undefined (reading 'init')
  29. }
  30. // suppose to call logging service to give an observable type report for every message streamed
  31. public subscribe(obs: Observable<any>): Observable<ResponseMessage> {
  32. obs.subscribe((data) => {
  33. // console.log(data)
  34. this.logService.subscribe(data)
  35. })
  36. let acknowledgementToken = obs.pipe(
  37. map(
  38. acknowledgement => acknowledgement
  39. // acknowledement => this.utilMessage.getResponseMessage(Parameters to be discussed)
  40. // this.logService(acknowledgement)
  41. ))
  42. this.logService.subscribe(acknowledgementToken) // Only log MessageObservable Type. Cannot log acknowledgement
  43. return acknowledgementToken// return response Message
  44. }
  45. }