|
@@ -1,15 +1,28 @@
|
|
-import { map, Observable, tap } from "rxjs";
|
|
|
|
-import { ResponseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
|
|
|
|
-import { FisCreateMessageUtility } from "../dependencies/fisappmessagejsutilty/services/fis.create.message";
|
|
|
|
|
|
+import { AnyObject } from "mongoose";
|
|
|
|
+import { map, Observable, of, tap } from "rxjs";
|
|
|
|
+import { Command, ResponseMessage } from "../dependencies/fisappmessagejsutilty/interface/export"
|
|
|
|
+import { FisCreateMessageUtility } from "../dependencies/fisappmessagejsutilty/interface/export";
|
|
import { LoggingService } from "../dependencies/fisloggingservice/services/logging-service";
|
|
import { LoggingService } from "../dependencies/fisloggingservice/services/logging-service";
|
|
import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
|
|
import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
|
|
-import { Acknowledgemeent } from "../interface/acknowledgement.interface";
|
|
|
|
|
|
+import { Acknowledgemeent, AcknowledgementLogSetting } from "../type/acknowledgement.interface";
|
|
|
|
|
|
|
|
|
|
export class AcknowledgementService implements Acknowledgemeent {
|
|
export class AcknowledgementService implements Acknowledgemeent {
|
|
|
|
|
|
private messageUtil: FisCreateMessageUtility = new FisCreateMessageUtility("FisAppID/Name")
|
|
private messageUtil: FisCreateMessageUtility = new FisCreateMessageUtility("FisAppID/Name")
|
|
- private settings: LogSetting = {
|
|
|
|
|
|
+ private settings1: LogSetting = {
|
|
|
|
+ storage: '',
|
|
|
|
+ setting: {
|
|
|
|
+ appId: '',
|
|
|
|
+ appName: '',
|
|
|
|
+ logLocName: '',
|
|
|
|
+ logLocId: '',
|
|
|
|
+ appLogLocId: '',
|
|
|
|
+ appLocName: '',
|
|
|
|
+ appLogId: ''
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private settings2: LogSetting = {
|
|
storage: '',
|
|
storage: '',
|
|
setting: {
|
|
setting: {
|
|
appId: '',
|
|
appId: '',
|
|
@@ -22,30 +35,51 @@ export class AcknowledgementService implements Acknowledgemeent {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- constructor(private logService?: LoggingService) {
|
|
|
|
|
|
+ constructor(private logService1?: LoggingService, private logService2?: LoggingService) {
|
|
|
|
+ this.logService1 = new LoggingService()
|
|
|
|
+ this.logService2 = new LoggingService()
|
|
}
|
|
}
|
|
|
|
|
|
// set the data. I dont know what to set yet
|
|
// set the data. I dont know what to set yet
|
|
- public async init(settings: LogSetting) {
|
|
|
|
|
|
+ public async init(settings: AcknowledgementLogSetting) {
|
|
|
|
+ let logSetting1: LogSetting = {
|
|
|
|
+ ...settings,
|
|
|
|
+ setting: {
|
|
|
|
+ ...settings.setting,
|
|
|
|
+ logLocName: "locationName1",
|
|
|
|
+ appLocName: "appLocName1"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let logSetting2: LogSetting = {
|
|
|
|
+ ...settings,
|
|
|
|
+ setting: {
|
|
|
|
+ ...settings.setting,
|
|
|
|
+ logLocName: "locationName2",
|
|
|
|
+ appLocName: "appLocName2"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// console.log(settings)
|
|
// console.log(settings)
|
|
- this.settings = settings
|
|
|
|
- this.logService.init(this.settings)
|
|
|
|
- // Error Cannot error properties of undefined (reading 'init')
|
|
|
|
|
|
+ this.settings1 = logSetting1
|
|
|
|
+ this.logService1.init(logSetting1)
|
|
|
|
+ this.settings2 = logSetting2
|
|
|
|
+ this.logService2.init(logSetting2)
|
|
}
|
|
}
|
|
|
|
|
|
// suppose to call logging service to give an observable type report for every message streamed
|
|
// suppose to call logging service to give an observable type report for every message streamed
|
|
public subscribe(obs: Observable<any>): Observable<ResponseMessage> {
|
|
public subscribe(obs: Observable<any>): Observable<ResponseMessage> {
|
|
- obs.subscribe((data) => {
|
|
|
|
- // console.log(data)
|
|
|
|
- this.logService.subscribe(data)
|
|
|
|
- })
|
|
|
|
- let acknowledgementToken = obs.pipe(
|
|
|
|
|
|
+ this.logService1.subscribe(obs)
|
|
|
|
+ let acknowledgementToken: Observable<ResponseMessage> = obs.pipe(
|
|
map(
|
|
map(
|
|
- acknowledgement => acknowledgement
|
|
|
|
- // acknowledement => this.utilMessage.getResponseMessage(Parameters to be discussed)
|
|
|
|
- // this.logService(acknowledgement)
|
|
|
|
|
|
+ incoming_msg => {
|
|
|
|
+ let emulatedId = "GeneratedFromMessageSync"
|
|
|
|
+ let emulatedRequest = this.messageUtil.getCommandMessage(emulatedId, Command.New, incoming_msg)
|
|
|
|
+ let finalResponse = this.messageUtil.getResponseMessage(emulatedId, { "Acknowledgement": 1 }, emulatedRequest)
|
|
|
|
+
|
|
|
|
+ return finalResponse
|
|
|
|
+ }
|
|
|
|
+
|
|
))
|
|
))
|
|
- this.logService.subscribe(acknowledgementToken) // Only log MessageObservable Type. Cannot log acknowledgement
|
|
|
|
- return acknowledgementToken// return response Message
|
|
|
|
|
|
+ this.logService2.subscribe(acknowledgementToken)
|
|
|
|
+ return acknowledgementToken
|
|
}
|
|
}
|
|
}
|
|
}
|