wsp-ms-core 1.0.78-beta-3 → 1.0.78-beta-4

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
@@ -36,7 +36,7 @@ __export(src_exports, {
36
36
  Country: () => Country,
37
37
  Currency: () => Currency,
38
38
  DateTime: () => DateTime,
39
- DefaultOutboxRunner: () => DefaultOutboxRunner,
39
+ DefaultMysqlOutboxRunner: () => DefaultMysqlOutboxRunner,
40
40
  DomainEntity: () => DomainEntity,
41
41
  DomainError: () => DomainError,
42
42
  DomainEvent: () => DomainEvent,
@@ -1662,11 +1662,10 @@ var MysqlConnection = class {
1662
1662
  }
1663
1663
  };
1664
1664
 
1665
- // src/infrastructure/runners/default-outbox-runner.ts
1666
- var DefaultOutboxRunner = class {
1667
- constructor(uowFactory, eventBusRepository, eventManager) {
1665
+ // src/infrastructure/runners/default-mysql-outbox-runner.ts
1666
+ var DefaultMysqlOutboxRunner = class {
1667
+ constructor(uowFactory, eventManager) {
1668
1668
  this.uowFactory = uowFactory;
1669
- this.eventBusRepository = eventBusRepository;
1670
1669
  this.eventManager = eventManager;
1671
1670
  this.interval = Number(process.env.OUTBOX_RUNNER_INTERVAL_MS || 5e3);
1672
1671
  this.maxEvents = Number(process.env.OUTBOX_RUNNER_MAX_EVENTS || 20);
@@ -1683,10 +1682,10 @@ var DefaultOutboxRunner = class {
1683
1682
  async sleep() {
1684
1683
  return new Promise((r) => setTimeout(r, this.maxEvents));
1685
1684
  }
1686
- async processOutboxRecord(e) {
1685
+ async processOutboxRecord(e, eventBusRepository) {
1687
1686
  try {
1688
1687
  e.markProcessing();
1689
- await this.eventBusRepository.update(e);
1688
+ await eventBusRepository.update(e);
1690
1689
  await this.eventManager.send(e.topic, e.payload);
1691
1690
  e.markProcessed();
1692
1691
  } catch (error) {
@@ -1694,16 +1693,17 @@ var DefaultOutboxRunner = class {
1694
1693
  e.markWithError(type);
1695
1694
  throw new Error(type);
1696
1695
  } finally {
1697
- await this.eventBusRepository.update(e);
1696
+ await eventBusRepository.update(e);
1698
1697
  }
1699
1698
  }
1700
1699
  async process() {
1701
1700
  const uow = await this.uowFactory.create();
1701
+ const eventBusRepository = new EventBusMysqlRepository(uow.connection);
1702
1702
  await uow.execute(async () => {
1703
- const records = await this.eventBusRepository.listPending(this.maxEvents);
1703
+ const records = await eventBusRepository.listPending(this.maxEvents);
1704
1704
  for (let record of records) {
1705
1705
  try {
1706
- await this.processOutboxRecord(record);
1706
+ await this.processOutboxRecord(record, eventBusRepository);
1707
1707
  } catch (error) {
1708
1708
  this.addError({ eventUuid: record.eventUuid.value, error: error.toString() });
1709
1709
  }
@@ -1780,7 +1780,7 @@ var ExchangeRates = class _ExchangeRates extends BaseObject {
1780
1780
  Country,
1781
1781
  Currency,
1782
1782
  DateTime,
1783
- DefaultOutboxRunner,
1783
+ DefaultMysqlOutboxRunner,
1784
1784
  DomainEntity,
1785
1785
  DomainError,
1786
1786
  DomainEvent,