wsp-ms-core 1.1.21 → 1.1.23
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 +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -703,10 +703,12 @@ declare class DefaultMysqlInboxRunner {
|
|
|
703
703
|
}
|
|
704
704
|
|
|
705
705
|
type InboxHandlerProcessor = (record: InboxRecord) => void;
|
|
706
|
+
type InboxErrorHandler = (record: InboxRecord, error: any) => void;
|
|
706
707
|
declare class DefaultMysqlInboxProcessor {
|
|
707
708
|
private uovFactory;
|
|
708
709
|
private handlers;
|
|
709
|
-
|
|
710
|
+
private onError?;
|
|
711
|
+
constructor(uowFactory: BasicUnitOfWorkFactory, onError?: InboxErrorHandler);
|
|
710
712
|
private sleep;
|
|
711
713
|
addHandlerForTopic(topic: string, handler: InboxHandlerProcessor): void;
|
|
712
714
|
processRecords(): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -703,10 +703,12 @@ declare class DefaultMysqlInboxRunner {
|
|
|
703
703
|
}
|
|
704
704
|
|
|
705
705
|
type InboxHandlerProcessor = (record: InboxRecord) => void;
|
|
706
|
+
type InboxErrorHandler = (record: InboxRecord, error: any) => void;
|
|
706
707
|
declare class DefaultMysqlInboxProcessor {
|
|
707
708
|
private uovFactory;
|
|
708
709
|
private handlers;
|
|
709
|
-
|
|
710
|
+
private onError?;
|
|
711
|
+
constructor(uowFactory: BasicUnitOfWorkFactory, onError?: InboxErrorHandler);
|
|
710
712
|
private sleep;
|
|
711
713
|
addHandlerForTopic(topic: string, handler: InboxHandlerProcessor): void;
|
|
712
714
|
processRecords(): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -2051,6 +2051,7 @@ var DefaultMysqlInboxRunner = class {
|
|
|
2051
2051
|
console.log(data);
|
|
2052
2052
|
});
|
|
2053
2053
|
this.eventManager.onMessage((data) => {
|
|
2054
|
+
console.log(JSON.stringify(data));
|
|
2054
2055
|
});
|
|
2055
2056
|
this.eventManager.onError((data) => {
|
|
2056
2057
|
console.log(data);
|
|
@@ -2074,9 +2075,10 @@ var DefaultMysqlInboxRunner = class {
|
|
|
2074
2075
|
|
|
2075
2076
|
// src/infrastructure/runners/default-mysql-inbox-processor.ts
|
|
2076
2077
|
var DefaultMysqlInboxProcessor = class {
|
|
2077
|
-
constructor(uowFactory) {
|
|
2078
|
+
constructor(uowFactory, onError) {
|
|
2078
2079
|
this.uovFactory = uowFactory;
|
|
2079
2080
|
this.handlers = /* @__PURE__ */ new Map();
|
|
2081
|
+
this.onError = onError;
|
|
2080
2082
|
}
|
|
2081
2083
|
async sleep() {
|
|
2082
2084
|
return new Promise((r) => setTimeout(r, 5e3));
|
|
@@ -2098,6 +2100,13 @@ var DefaultMysqlInboxProcessor = class {
|
|
|
2098
2100
|
record.markProcessed();
|
|
2099
2101
|
} catch (error) {
|
|
2100
2102
|
record.markWithError(error.toString());
|
|
2103
|
+
if (this.onError) {
|
|
2104
|
+
try {
|
|
2105
|
+
this.onError(record, error);
|
|
2106
|
+
} catch (handlerError) {
|
|
2107
|
+
console.error("Error dentro del onError handler:", handlerError);
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2101
2110
|
} finally {
|
|
2102
2111
|
await repository.update(record);
|
|
2103
2112
|
}
|