wsp-ms-core 1.0.88 → 1.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +18 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +18 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1908,12 +1908,10 @@ var InboxMysqlRepository = class {
|
|
|
1908
1908
|
|
|
1909
1909
|
// src/infrastructure/runners/default-mysql-inbox-runner.ts
|
|
1910
1910
|
var DefaultMysqlInboxRunner = class {
|
|
1911
|
-
constructor(
|
|
1911
|
+
constructor(databaseConnector, eventManager) {
|
|
1912
1912
|
this.topics = [];
|
|
1913
|
-
this.
|
|
1913
|
+
this.databaseConnector = databaseConnector;
|
|
1914
1914
|
this.eventManager = eventManager;
|
|
1915
|
-
this.interval = Number(process.env.OUTBOX_RUNNER_INTERVAL_MS || 5e3);
|
|
1916
|
-
this.maxEvents = Number(process.env.OUTBOX_RUNNER_MAX_EVENTS || 20);
|
|
1917
1915
|
}
|
|
1918
1916
|
async saveEvent(e, repository) {
|
|
1919
1917
|
let record = new InboxRecord(
|
|
@@ -1938,26 +1936,26 @@ var DefaultMysqlInboxRunner = class {
|
|
|
1938
1936
|
this.topics.push(topic);
|
|
1939
1937
|
}
|
|
1940
1938
|
async process() {
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
}
|
|
1939
|
+
for (let topic of this.topics) {
|
|
1940
|
+
try {
|
|
1941
|
+
this.eventManager.onSubscribe((data) => {
|
|
1942
|
+
console.log(data);
|
|
1943
|
+
});
|
|
1944
|
+
this.eventManager.onMessage((data) => {
|
|
1945
|
+
console.log(data);
|
|
1946
|
+
});
|
|
1947
|
+
this.eventManager.route(topic, async (e) => {
|
|
1948
|
+
await this.saveEvent(e, new InboxMysqlRepository(await this.databaseConnector.getConnection()));
|
|
1949
|
+
});
|
|
1950
|
+
} catch (error) {
|
|
1951
|
+
console.log(error.toString());
|
|
1952
1952
|
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1953
|
+
}
|
|
1954
|
+
await this.eventManager.start();
|
|
1955
1955
|
}
|
|
1956
1956
|
async start() {
|
|
1957
1957
|
console.log("[inbox-runner]: start");
|
|
1958
|
-
|
|
1959
|
-
await this.process();
|
|
1960
|
-
}
|
|
1958
|
+
await this.process();
|
|
1961
1959
|
}
|
|
1962
1960
|
};
|
|
1963
1961
|
|