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 +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -579,14 +579,13 @@ declare class MysqlConnection implements DatabaseConnection<string, any[], RowDa
|
|
|
579
579
|
close(): Promise<void>;
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
-
declare class
|
|
582
|
+
declare class DefaultMysqlOutboxRunner {
|
|
583
583
|
private readonly uowFactory;
|
|
584
|
-
private readonly eventBusRepository;
|
|
585
584
|
private readonly eventManager;
|
|
586
585
|
private readonly interval;
|
|
587
586
|
private readonly maxEvents;
|
|
588
587
|
private errors;
|
|
589
|
-
constructor(uowFactory: BasicUnitOfWorkFactory,
|
|
588
|
+
constructor(uowFactory: BasicUnitOfWorkFactory, eventManager: EventManager);
|
|
590
589
|
private addError;
|
|
591
590
|
private logErrors;
|
|
592
591
|
private sleep;
|
|
@@ -619,4 +618,4 @@ declare class StringVars {
|
|
|
619
618
|
}): string;
|
|
620
619
|
}
|
|
621
620
|
|
|
622
|
-
export { BaseEntity, BaseEvent, BaseObject, BasicUnitOfWork, BasicUnitOfWorkFactory, Country, Currency, DatabaseConnection, DatabaseConnector, DateTime,
|
|
621
|
+
export { BaseEntity, BaseEvent, BaseObject, BasicUnitOfWork, BasicUnitOfWorkFactory, Country, Currency, DatabaseConnection, DatabaseConnector, DateTime, DefaultMysqlOutboxRunner, DomainEntity, DomainError, DomainEvent, Email, ErrorManager, ErrorManagerHandleResult, ErrorTemplate, EventBus, EventBusMysqlRepository, EventBusRepository, EventManager, EventManagerConnection, ExchangeRates, FatalError, HttpController, HttpHealthCheckController, HttpNotFoundController, HttpRequest, HttpResponse, IntegrationEvent, InternalError, KafkaManager, Language, Logger, MysqlConnection, MysqlConnector, OutboxRecord, PaymentGateway, PaymentStatus, Price, ProcessStatus, RouteCallback, RoutesCallbackList, StringVars, UUID, UnitOfWork, UploadedFile, UsageError, ValueObject, adaptExpressErrorHandler, adaptExpressRoute };
|
package/dist/index.js
CHANGED
|
@@ -1591,11 +1591,10 @@ var MysqlConnection = class {
|
|
|
1591
1591
|
}
|
|
1592
1592
|
};
|
|
1593
1593
|
|
|
1594
|
-
// src/infrastructure/runners/default-outbox-runner.ts
|
|
1595
|
-
var
|
|
1596
|
-
constructor(uowFactory,
|
|
1594
|
+
// src/infrastructure/runners/default-mysql-outbox-runner.ts
|
|
1595
|
+
var DefaultMysqlOutboxRunner = class {
|
|
1596
|
+
constructor(uowFactory, eventManager) {
|
|
1597
1597
|
this.uowFactory = uowFactory;
|
|
1598
|
-
this.eventBusRepository = eventBusRepository;
|
|
1599
1598
|
this.eventManager = eventManager;
|
|
1600
1599
|
this.interval = Number(process.env.OUTBOX_RUNNER_INTERVAL_MS || 5e3);
|
|
1601
1600
|
this.maxEvents = Number(process.env.OUTBOX_RUNNER_MAX_EVENTS || 20);
|
|
@@ -1612,10 +1611,10 @@ var DefaultOutboxRunner = class {
|
|
|
1612
1611
|
async sleep() {
|
|
1613
1612
|
return new Promise((r) => setTimeout(r, this.maxEvents));
|
|
1614
1613
|
}
|
|
1615
|
-
async processOutboxRecord(e) {
|
|
1614
|
+
async processOutboxRecord(e, eventBusRepository) {
|
|
1616
1615
|
try {
|
|
1617
1616
|
e.markProcessing();
|
|
1618
|
-
await
|
|
1617
|
+
await eventBusRepository.update(e);
|
|
1619
1618
|
await this.eventManager.send(e.topic, e.payload);
|
|
1620
1619
|
e.markProcessed();
|
|
1621
1620
|
} catch (error) {
|
|
@@ -1623,16 +1622,17 @@ var DefaultOutboxRunner = class {
|
|
|
1623
1622
|
e.markWithError(type);
|
|
1624
1623
|
throw new Error(type);
|
|
1625
1624
|
} finally {
|
|
1626
|
-
await
|
|
1625
|
+
await eventBusRepository.update(e);
|
|
1627
1626
|
}
|
|
1628
1627
|
}
|
|
1629
1628
|
async process() {
|
|
1630
1629
|
const uow = await this.uowFactory.create();
|
|
1630
|
+
const eventBusRepository = new EventBusMysqlRepository(uow.connection);
|
|
1631
1631
|
await uow.execute(async () => {
|
|
1632
|
-
const records = await
|
|
1632
|
+
const records = await eventBusRepository.listPending(this.maxEvents);
|
|
1633
1633
|
for (let record of records) {
|
|
1634
1634
|
try {
|
|
1635
|
-
await this.processOutboxRecord(record);
|
|
1635
|
+
await this.processOutboxRecord(record, eventBusRepository);
|
|
1636
1636
|
} catch (error) {
|
|
1637
1637
|
this.addError({ eventUuid: record.eventUuid.value, error: error.toString() });
|
|
1638
1638
|
}
|
|
@@ -1708,7 +1708,7 @@ export {
|
|
|
1708
1708
|
Country,
|
|
1709
1709
|
Currency,
|
|
1710
1710
|
DateTime,
|
|
1711
|
-
|
|
1711
|
+
DefaultMysqlOutboxRunner,
|
|
1712
1712
|
DomainEntity,
|
|
1713
1713
|
DomainError,
|
|
1714
1714
|
DomainEvent,
|