wsp-ms-core 1.0.95 → 1.0.97

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 CHANGED
@@ -1960,8 +1960,9 @@ var DefaultMysqlInboxRunner = class {
1960
1960
 
1961
1961
  // src/infrastructure/runners/default-mysql-inbox-processor.ts
1962
1962
  var DefaultMysqlInboxProcessor = class {
1963
- constructor(repository) {
1964
- this.repository = repository;
1963
+ constructor(uowFactory) {
1964
+ this.uovFactory = uowFactory;
1965
+ this.handlers = /* @__PURE__ */ new Map();
1965
1966
  }
1966
1967
  async sleep() {
1967
1968
  return new Promise((r) => setTimeout(r, 5e3));
@@ -1970,12 +1971,16 @@ var DefaultMysqlInboxProcessor = class {
1970
1971
  this.handlers.set(topic, handler);
1971
1972
  }
1972
1973
  async processRecords() {
1973
- const records = await this.repository.listPending(20);
1974
- for (let record of records) {
1975
- if (this.handlers.has(record.topic)) {
1976
- await this.handlers.get(record.topic)(record);
1974
+ const uow = await this.uovFactory.create();
1975
+ const repository = new InboxMysqlRepository(uow.connection);
1976
+ await uow.execute(async () => {
1977
+ const records = await repository.listPending(20);
1978
+ for (let record of records) {
1979
+ if (this.handlers.has(record.topic)) {
1980
+ await this.handlers.get(record.topic)(record);
1981
+ }
1977
1982
  }
1978
- }
1983
+ });
1979
1984
  }
1980
1985
  async start() {
1981
1986
  console.log("[inbox-runner-processor]: start");