acknowledgemeent.service.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. ))
  41. this.logService.subscribe(acknowledgementToken) // Only log MessageObservable Type. Cannot log acknowledgement
  42. return // return response Message
  43. }
  44. }