|
@@ -11,24 +11,34 @@ export class IncomingMessageService implements IncomingMessageServiceInterface {
|
|
this.logService = new LoggingService()
|
|
this.logService = new LoggingService()
|
|
this.acknowledgeService = new AcknowledgementService()
|
|
this.acknowledgeService = new AcknowledgementService()
|
|
}
|
|
}
|
|
- init(settings: LogSetting & { incomingObservable: Observable<BaseMessage>; }): void {
|
|
|
|
|
|
+ public init(settings: LogSetting & { incomingObservable: Observable<BaseMessage>; }): void {
|
|
let logSetting: LogSetting = {
|
|
let logSetting: LogSetting = {
|
|
storage: settings.storage,
|
|
storage: settings.storage,
|
|
setting: settings.setting,
|
|
setting: settings.setting,
|
|
customSetting: settings.customSetting
|
|
customSetting: settings.customSetting
|
|
}
|
|
}
|
|
|
|
+
|
|
// Transform incoming observables into Observable<MessageLog> to be logged
|
|
// Transform incoming observables into Observable<MessageLog> to be logged
|
|
let transformedOBS: Observable<any> = settings.incomingObservable.pipe(
|
|
let transformedOBS: Observable<any> = settings.incomingObservable.pipe(
|
|
- map(
|
|
|
|
- messages => (messages.data)
|
|
|
|
- )
|
|
|
|
|
|
+ map(messages => (messages.data))
|
|
)
|
|
)
|
|
|
|
+
|
|
|
|
+ /* Trying new promise chaining structure */
|
|
this.logService.init(logSetting).then(() => {
|
|
this.logService.init(logSetting).then(() => {
|
|
- this.logService.subscribe(transformedOBS).then(() => {
|
|
|
|
- this.acknowledgeService.init(logSetting).then(() => {
|
|
|
|
- this.acknowledgeService.subscribe(transformedOBS)
|
|
|
|
- }).catch((e) => console.error(e))
|
|
|
|
- }).catch((e) => console.log(e))
|
|
|
|
|
|
+ this.logService.subscribe(transformedOBS)
|
|
|
|
+ }).catch((e) => console.error(e)).then(() => {
|
|
|
|
+ this.acknowledgeService.init(logSetting)
|
|
|
|
+ }).catch((e) => console.error(e)).then(() => {
|
|
|
|
+ this.acknowledgeService.subscribe(transformedOBS)
|
|
}).catch((e) => console.error(e))
|
|
}).catch((e) => console.error(e))
|
|
|
|
+
|
|
|
|
+ // this.logService.init(logSetting).then(() => {
|
|
|
|
+ // this.logService.subscribe(transformedOBS).then(() => {
|
|
|
|
+ // this.acknowledgeService.init(logSetting).then(() => {
|
|
|
|
+ // this.acknowledgeService.subscribe(transformedOBS)
|
|
|
|
+ // }).catch((e) => console.error(e))
|
|
|
|
+ // }).catch((e) => console.log(e))
|
|
|
|
+ // }).catch((e) => console.error(e))
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|