|
@@ -1,7 +1,7 @@
|
|
|
import { resolve } from "path";
|
|
|
import { Observable, map, Subject, takeUntil, take } from "rxjs";
|
|
|
import { BaseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
|
|
|
-import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
|
|
|
+import { LogSetting, MessageLog } from "../dependencies/fisloggingservice/type/datatype";
|
|
|
import { AcknowledgementService } from "../services/acknowledgement.service";
|
|
|
import { IncomingMessageService } from "../services/incomingMessage.service";
|
|
|
import { MessageSyncrhonizationService } from "../services/synchronization.service";
|
|
@@ -11,11 +11,18 @@ import { StreamingService } from "./test-streamOBS";
|
|
|
|
|
|
|
|
|
const stream = new StreamingService()
|
|
|
+
|
|
|
|
|
|
const source_synchronize = new MessageSyncrhonizationService()
|
|
|
-const source_payload: Observable<BaseMessage> = stream.stream()
|
|
|
+const source_payload: Observable<BaseMessage> = stream.stream().pipe()
|
|
|
const source_incoming = new IncomingMessageService()
|
|
|
-const source_acknowledge = new AcknowledgementService()
|
|
|
+const source_payload_subject: Subject<BaseMessage> = new Subject()
|
|
|
+source_payload.subscribe({
|
|
|
+ next: (data) => {
|
|
|
+ source_payload_subject.next(data)
|
|
|
+
|
|
|
+ }
|
|
|
+})
|
|
|
const source_payload_string = source_payload.pipe(
|
|
|
map((data) => {
|
|
|
return JSON.stringify(data);
|
|
@@ -23,25 +30,29 @@ const source_payload_string = source_payload.pipe(
|
|
|
)
|
|
|
|
|
|
|
|
|
+const target_syncrhonize = new MessageSyncrhonizationService()
|
|
|
const target_payload: Observable<BaseMessage> = stream.stream().pipe(take(2))
|
|
|
const target_payload_subject: Subject<BaseMessage> = new Subject()
|
|
|
-target_payload.subscribe(
|
|
|
- {
|
|
|
- next: (data) => {
|
|
|
- target_payload_subject.next(data)
|
|
|
- }
|
|
|
- }
|
|
|
-)
|
|
|
const target_incoming = new IncomingMessageService()
|
|
|
-const target_syncrhonize = new MessageSyncrhonizationService()
|
|
|
-const target_acknowledge = new AcknowledgementService()
|
|
|
+target_payload.subscribe({
|
|
|
+ next: (data) => {
|
|
|
+ target_payload_subject.next(<BaseMessage>data)
|
|
|
+ }
|
|
|
+})
|
|
|
const target_payload_string = target_payload.pipe(
|
|
|
map((data) => {
|
|
|
return JSON.stringify(data);
|
|
|
}),
|
|
|
)
|
|
|
+
|
|
|
+target_payload_subject.subscribe({
|
|
|
+ next: element => {
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
-
|
|
|
+
|
|
|
let source_storage: LogSetting = {
|
|
|
storage: "File",
|
|
|
setting: {
|
|
@@ -55,7 +66,7 @@ let source_dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> }
|
|
|
storage: source_storage.storage,
|
|
|
setting: source_storage.setting,
|
|
|
customSetting: source_storage.customSetting,
|
|
|
- incomingObservable: source_payload
|
|
|
+ incomingObservable: source_payload_subject
|
|
|
}
|
|
|
|
|
|
|
|
@@ -74,11 +85,12 @@ let target_storage: LogSetting = {
|
|
|
collection: "log",
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
let target_dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> } = {
|
|
|
storage: target_storage.storage,
|
|
|
setting: target_storage.setting,
|
|
|
customSetting: target_storage.customSetting,
|
|
|
- incomingObservable: target_payload
|
|
|
+ incomingObservable: target_payload_subject
|
|
|
}
|
|
|
|
|
|
|
|
@@ -94,94 +106,35 @@ let settings: MessageSynchronisationServiceSetting = {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-setTimeout(()=>{
|
|
|
- target_payload_subject.next(
|
|
|
- <BaseMessage>{
|
|
|
- "header": {
|
|
|
- "messageType": "Command",
|
|
|
- "messageID": "ab05f310-f3c5-4fd0-9af1-15cda97b4444",
|
|
|
- "messageName": "Command",
|
|
|
- "dateCreated": "2023-02-13T03:33:58.746Z",
|
|
|
- "isAggregate": false,
|
|
|
- "dataSourceTiming": "",
|
|
|
- "serviceId": "",
|
|
|
- "userId": "",
|
|
|
- "requesterId": "Generatede203a86a-c99e-460e-95ff-f2dc7f484a7d",
|
|
|
- "messageProducerInformation": {
|
|
|
- "origin": {
|
|
|
- "userApplication": {
|
|
|
- "userAppId": "FisAppID/Name",
|
|
|
- "userAppName": "Client"
|
|
|
- }
|
|
|
- },
|
|
|
- "components": "Presentation"
|
|
|
- },
|
|
|
- "security": {
|
|
|
- "ucpId": "GeneratedFromMessageSync"
|
|
|
- },
|
|
|
- "messageDataLocation": {
|
|
|
- "isEmbaded": true
|
|
|
- },
|
|
|
- "messageDataFormat": {
|
|
|
- "dataFormat": "Json"
|
|
|
- },
|
|
|
- "requestExecutionMode": 0,
|
|
|
- "resquestTimeOut": 0,
|
|
|
- "command": "New"
|
|
|
- },
|
|
|
- "data": {
|
|
|
- "header": "fa29074d-9718-4aba-9999-0001",
|
|
|
- "data": {
|
|
|
- "appLogLocId": "fa29074d-9718-4aba-9999-0001",
|
|
|
- "appData": {
|
|
|
- "msgId": "6c162cd3-d42d-4ab4-8882-0001",
|
|
|
- "msgLogDateTime": "2022-12-06T15:01:46.987Z",
|
|
|
- "msgDateTime": "2022-12-06T08:50:33.809Z",
|
|
|
- "msgTag": [
|
|
|
- "oval",
|
|
|
- "likable"
|
|
|
- ],
|
|
|
- "msgPayload": "Molestias facilis iusto similique iste voluptas facere. Alias est sequi. Quos consequatur temporibus blanditiis numquam vel. Eos repellat eaque. Voluptatibus optio optio magni eveniet. Quidem architecto esse aut sint neque error magnam perspiciatis."
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
-},2000)
|
|
|
|
|
|
|
|
|
-async function initializeData(): Promise<void> {
|
|
|
+function initializeData() {
|
|
|
source_incoming.init(source_dataSet)
|
|
|
target_incoming.init(target_dataSet)
|
|
|
- return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
when there is a streaming occuring. */
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
source_synchronize.init(settings).then(() => {
|
|
|
- source_synchronize.subscribe(source_payload_string).subscribe({
|
|
|
- next: msgToBeSynchronized => {
|
|
|
- target_payload_subject.next(msgToBeSynchronized)
|
|
|
-
|
|
|
+ let stream = source_synchronize.subscribe(source_payload_string)
|
|
|
+ stream.subscribe({
|
|
|
+ next: (messageToBeSync) => {
|
|
|
+ target_payload_subject.next(messageToBeSync)
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
+
|