@axinom/mosaic-transactional-inbox-outbox 0.1.2 → 0.1.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/inbox/get-transactional-inbox-config.d.ts +2 -2
- package/dist/inbox/get-transactional-inbox-config.d.ts.map +1 -1
- package/dist/inbox/get-transactional-inbox-config.js.map +1 -1
- package/dist/inbox/transactional-inbox-message-handler.d.ts.map +1 -1
- package/dist/inbox/transactional-inbox-message-handler.js +4 -4
- package/dist/inbox/transactional-inbox-message-handler.js.map +1 -1
- package/dist/outbox/get-transactional-outbox-config.d.ts +2 -2
- package/dist/outbox/get-transactional-outbox-config.d.ts.map +1 -1
- package/dist/outbox/get-transactional-outbox-config.js.map +1 -1
- package/dist/outbox/setup-transactional-outbox-message-service.d.ts +2 -1
- package/dist/outbox/setup-transactional-outbox-message-service.d.ts.map +1 -1
- package/dist/outbox/setup-transactional-outbox-message-service.js +2 -2
- package/dist/outbox/setup-transactional-outbox-message-service.js.map +1 -1
- package/dist/transactional-logger.d.ts +13 -1
- package/dist/transactional-logger.d.ts.map +1 -1
- package/dist/transactional-logger.js +3 -7
- package/dist/transactional-logger.js.map +1 -1
- package/package.json +3 -3
- package/src/inbox/get-transactional-inbox-config.ts +2 -4
- package/src/inbox/transactional-inbox-message-handler.ts +4 -8
- package/src/outbox/get-transactional-outbox-config.ts +2 -2
- package/src/outbox/setup-transactional-outbox-message-service.ts +8 -2
- package/src/transactional-logger.ts +1 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InboxConfig } from 'pg-transactional-outbox';
|
|
2
2
|
import { DbConfig } from '../common';
|
|
3
|
-
export declare const getTransactionalInboxConfig: (config: DbConfig) =>
|
|
3
|
+
export declare const getTransactionalInboxConfig: (config: DbConfig) => InboxConfig;
|
|
4
4
|
//# sourceMappingURL=get-transactional-inbox-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-transactional-inbox-config.d.ts","sourceRoot":"","sources":["../../src/inbox/get-transactional-inbox-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-transactional-inbox-config.d.ts","sourceRoot":"","sources":["../../src/inbox/get-transactional-inbox-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAsC,MAAM,WAAW,CAAC;AAEzE,eAAO,MAAM,2BAA2B,WAAY,QAAQ,KAAG,WAsB9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-transactional-inbox-config.js","sourceRoot":"","sources":["../../src/inbox/get-transactional-inbox-config.ts"],"names":[],"mappings":";;;AACA,sCAAyE;AAElE,MAAM,2BAA2B,GAAG,
|
|
1
|
+
{"version":3,"file":"get-transactional-inbox-config.js","sourceRoot":"","sources":["../../src/inbox/get-transactional-inbox-config.ts"],"names":[],"mappings":";;;AACA,sCAAyE;AAElE,MAAM,2BAA2B,GAAG,CAAC,MAAgB,EAAe,EAAE;;IAC3E,OAAO;QACL,QAAQ,EAAE;YACR,gBAAgB,EAAE,MAAM,CAAC,0BAA0B;SACpD;QACD,mBAAmB,EAAE;YACnB,gBAAgB,EAAE,MAAM,CAAC,kCAAkC;SAC5D;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,MAAA,MAAM,CAAC,0BAA0B,mCAAI,YAAY;YAC3D,OAAO,EAAE,MAAA,MAAM,CAAC,yBAAyB,mCAAI,OAAO;YACpD,WAAW,EACT,MAAA,MAAM,CAAC,6BAA6B,mCACpC,2CAAkC;YACpC,YAAY,EAAE,MAAM,CAAC,iCAAiC;YACtD,WAAW,EAAE,MAAM,CAAC,6BAA6B;YACjD,wBAAwB,EACtB,MAAM,CAAC,yCAAyC;YAClD,YAAY,EAAE,MAAM,CAAC,6BAA6B;YAClD,qBAAqB,EAAE,MAAM,CAAC,sCAAsC;SACrE;KACF,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,2BAA2B,+BAsBtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactional-inbox-message-handler.d.ts","sourceRoot":"","sources":["../../src/inbox/transactional-inbox-message-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,aAAa,
|
|
1
|
+
{"version":3,"file":"transactional-inbox-message-handler.d.ts","sourceRoot":"","sources":["../../src/inbox/transactional-inbox-message-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,aAAa,EAEd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9D,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IACxE,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,yBAAyB,CAAC,CAAC,CAC1C,SAAQ,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC;IAEX,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;CACpC;AAED,UAAU,kBAAkB,CAC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AE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAC1C,QAAQ,CAAC,EAAE,QAAQ,GAClB,OAAO,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAWjD;;;;;;OAMG;IACU,MAAM,CACjB,OAAO,EAAE,YAAY,EACrB,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;;;;;;OASG;IACU,WAAW,CACtB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,YAAY,EACrB,cAAc,EAAE,UAAU,EAC1B,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GACzC,OAAO,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAiBjD;;;OAGG;IACI,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;CAGrC"}
|
|
@@ -32,10 +32,10 @@ class TransactionalInboxMessageHandler {
|
|
|
32
32
|
*/
|
|
33
33
|
async handleErrorMessage(error, message, _envOwnerClient, attempts, _context) {
|
|
34
34
|
if (attempts.current >= attempts.max) {
|
|
35
|
-
|
|
36
|
-
error
|
|
37
|
-
details: message,
|
|
38
|
-
}
|
|
35
|
+
this.logger.error({
|
|
36
|
+
message: `The final message handling attempt failed: ${error.message}`,
|
|
37
|
+
details: Object.assign(Object.assign({}, message), { error }),
|
|
38
|
+
});
|
|
39
39
|
return 'permanent_error';
|
|
40
40
|
}
|
|
41
41
|
return 'transient_error';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactional-inbox-message-handler.js","sourceRoot":"","sources":["../../src/inbox/transactional-inbox-message-handler.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"transactional-inbox-message-handler.js","sourceRoot":"","sources":["../../src/inbox/transactional-inbox-message-handler.ts"],"names":[],"mappings":";;;AAGA,qEAKiC;AA+BjC,MAAsB,gCAAgC;IAUp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A0C;;QAE1C,MAAM,GAAG,GAAwC,OAAO,CAAC;QACzD,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,kBAAkB,qDAAG,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC,CAAA,CAAC;QACxE,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,CACvC,CAAC,EACoC,OAAO,EAC5C,cAAc,EACd,QAAQ,EACR,OAAO,CACR,CAAC;QACF,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,GAAG,EAAE;YACpC,OAAO,iBAAiB,CAAC;SAC1B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,KAAY;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA9HD,4EA8HC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransactionalOutboxInboxConfig } from 'pg-transactional-outbox';
|
|
2
2
|
import { DbConfig } from '../common';
|
|
3
|
-
export declare const getTransactionalOutboxConfig: (config: DbConfig) =>
|
|
3
|
+
export declare const getTransactionalOutboxConfig: (config: DbConfig) => TransactionalOutboxInboxConfig;
|
|
4
4
|
//# sourceMappingURL=get-transactional-outbox-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-transactional-outbox-config.d.ts","sourceRoot":"","sources":["../../src/outbox/get-transactional-outbox-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-transactional-outbox-config.d.ts","sourceRoot":"","sources":["../../src/outbox/get-transactional-outbox-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAuC,MAAM,WAAW,CAAC;AAE1E,eAAO,MAAM,4BAA4B,WAC/B,QAAQ,KACf,8BAkBF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-transactional-outbox-config.js","sourceRoot":"","sources":["../../src/outbox/get-transactional-outbox-config.ts"],"names":[],"mappings":";;;AACA,sCAA0E;AAEnE,MAAM,4BAA4B,GAAG,CAC1C,MAAgB,
|
|
1
|
+
{"version":3,"file":"get-transactional-outbox-config.js","sourceRoot":"","sources":["../../src/outbox/get-transactional-outbox-config.ts"],"names":[],"mappings":";;;AACA,sCAA0E;AAEnE,MAAM,4BAA4B,GAAG,CAC1C,MAAgB,EACgB,EAAE;;IAClC,OAAO;QACL,mBAAmB,EAAE;YACnB,gBAAgB,EAAE,MAAM,CAAC,kCAAkC;SAC5D;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,MAAA,MAAM,CAAC,2BAA2B,mCAAI,YAAY;YAC5D,OAAO,EAAE,MAAA,MAAM,CAAC,0BAA0B,mCAAI,QAAQ;YACtD,WAAW,EACT,MAAA,MAAM,CAAC,8BAA8B,mCACrC,4CAAmC;YACrC,YAAY,EAAE,MAAM,CAAC,kCAAkC;YACvD,wBAAwB,EACtB,MAAM,CAAC,yCAAyC;YAClD,YAAY,EAAE,MAAM,CAAC,6BAA6B;YAClD,qBAAqB,EAAE,MAAM,CAAC,sCAAsC;SACrE;KACF,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,4BAA4B,gCAoBvC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Broker } from '@axinom/mosaic-message-bus';
|
|
2
|
+
import { TransactionalLogger } from 'pg-transactional-outbox';
|
|
2
3
|
import { DbConfig } from '../common';
|
|
3
4
|
/**
|
|
4
5
|
* Setup the transactional outbox service to send messages
|
|
@@ -6,5 +7,5 @@ import { DbConfig } from '../common';
|
|
|
6
7
|
* @param broker RabbitMQ based messaging broker
|
|
7
8
|
* @returns shutdown action to stop the messaging service
|
|
8
9
|
*/
|
|
9
|
-
export declare const setupTransactionalOutboxMessageService: (config: DbConfig, broker: Broker) => Promise<() => Promise<void>>;
|
|
10
|
+
export declare const setupTransactionalOutboxMessageService: (config: DbConfig, broker: Broker, logger: TransactionalLogger) => Promise<() => Promise<void>>;
|
|
10
11
|
//# sourceMappingURL=setup-transactional-outbox-message-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-transactional-outbox-message-service.d.ts","sourceRoot":"","sources":["../../src/outbox/setup-transactional-outbox-message-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"setup-transactional-outbox-message-service.d.ts","sourceRoot":"","sources":["../../src/outbox/setup-transactional-outbox-message-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAEL,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AA2BrC;;;;;GAKG;AACH,eAAO,MAAM,sCAAsC,WACzC,QAAQ,UACR,MAAM,UACN,mBAAmB,KAC1B,QAAQ,MAAM,QAAQ,IAAI,CAAC,CAW7B,CAAC"}
|
|
@@ -21,10 +21,10 @@ const setupRabbitMqPublisher = async (broker) => {
|
|
|
21
21
|
* @param broker RabbitMQ based messaging broker
|
|
22
22
|
* @returns shutdown action to stop the messaging service
|
|
23
23
|
*/
|
|
24
|
-
const setupTransactionalOutboxMessageService = async (config, broker) => {
|
|
24
|
+
const setupTransactionalOutboxMessageService = async (config, broker, logger) => {
|
|
25
25
|
const outboxServiceConfig = (0, get_transactional_outbox_config_1.getTransactionalOutboxConfig)(config);
|
|
26
26
|
const [rmqPublisher] = await setupRabbitMqPublisher(broker);
|
|
27
|
-
const [shutdown] = (0, pg_transactional_outbox_1.
|
|
27
|
+
const [shutdown] = (0, pg_transactional_outbox_1.initializeOutboxListener)(outboxServiceConfig, rmqPublisher, logger);
|
|
28
28
|
return shutdown;
|
|
29
29
|
};
|
|
30
30
|
exports.setupTransactionalOutboxMessageService = setupTransactionalOutboxMessageService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-transactional-outbox-message-service.js","sourceRoot":"","sources":["../../src/outbox/setup-transactional-outbox-message-service.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"setup-transactional-outbox-message-service.js","sourceRoot":"","sources":["../../src/outbox/setup-transactional-outbox-message-service.ts"],"names":[],"mappings":";;;AAEA,qEAIiC;AAGjC,uFAAiF;AAGjF,MAAM,sBAAsB,GAAG,KAAK,EAClC,MAAc,EAC8B,EAAE;IAC9C,OAAO;QACL,KAAK,EAAE,OAAsB,EAAiB,EAAE;YAC9C,oBAAoB;YACpB,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAClC,OAAO,CAAC,QAAkC,CAAC;YAC7C,MAAM,MAAM,CAAC,OAAO,CAClB,OAAO,CAAC,WAAW,EACnB;gBACE,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,WAAW,EAAE,OAAO,CAAC,WAAW;aACjC,EACD,OAAO,CAAC,OAAO,EACf,iBAAiB,EACjB,OAAO,CACR,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACI,MAAM,sCAAsC,GAAG,KAAK,EACzD,MAAgB,EAChB,MAAc,EACd,MAA2B,EACG,EAAE;IAChC,MAAM,mBAAmB,GAAG,IAAA,8DAA4B,EAAC,MAAM,CAAC,CAAC;IACjE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAE5D,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAA,kDAAwB,EACzC,mBAAmB,EACnB,YAAY,EACZ,MAAM,CACP,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAfW,QAAA,sCAAsC,0CAejD"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import { InboxOutboxLogger } from './common';
|
|
2
|
-
export declare
|
|
2
|
+
export declare class TransactionalLogMapper {
|
|
3
|
+
private logger;
|
|
4
|
+
constructor(logger: InboxOutboxLogger, logLevel: string);
|
|
5
|
+
fatal(obj: unknown, msg?: string): void;
|
|
6
|
+
error(obj: unknown, msg?: string): void;
|
|
7
|
+
warn(obj: unknown, msg?: string): void;
|
|
8
|
+
info(obj: unknown, msg?: string): void;
|
|
9
|
+
debug(obj: unknown, msg?: string): void;
|
|
10
|
+
trace(obj: unknown, msg?: string): void;
|
|
11
|
+
silent(): void;
|
|
12
|
+
level: string;
|
|
13
|
+
private log;
|
|
14
|
+
}
|
|
3
15
|
//# sourceMappingURL=transactional-logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactional-logger.d.ts","sourceRoot":"","sources":["../src/transactional-logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transactional-logger.d.ts","sourceRoot":"","sources":["../src/transactional-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAc,MAAM,UAAU,CAAC;AAIzD,qBAAa,sBAAsB;IACrB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM;IAIxD,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAGvC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAGvC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAGtC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAGtC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAGvC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAGvC,MAAM,IAAI,IAAI;IAGrB,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,CAAC,GAAG;CAWZ"}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const pg_transactional_outbox_1 = require("pg-transactional-outbox");
|
|
5
|
-
const setTransactionalLogger = (logger, logLevel) => {
|
|
6
|
-
(0, pg_transactional_outbox_1.setLogger)(new TransactionalLogger(logger, logLevel));
|
|
7
|
-
};
|
|
8
|
-
exports.setTransactionalLogger = setTransactionalLogger;
|
|
3
|
+
exports.TransactionalLogMapper = void 0;
|
|
9
4
|
// The pg-transactional-outbox library uses a central logger based in Pino.
|
|
10
5
|
// This logger matches the Mosaic based logger to the Pino one.
|
|
11
|
-
class
|
|
6
|
+
class TransactionalLogMapper {
|
|
12
7
|
constructor(logger, logLevel) {
|
|
13
8
|
this.logger = logger;
|
|
14
9
|
this.level = logLevel;
|
|
@@ -48,6 +43,7 @@ class TransactionalLogger {
|
|
|
48
43
|
}
|
|
49
44
|
}
|
|
50
45
|
}
|
|
46
|
+
exports.TransactionalLogMapper = TransactionalLogMapper;
|
|
51
47
|
const getLogMessage = (obj, message) => {
|
|
52
48
|
if (typeof obj !== 'object' || !obj) {
|
|
53
49
|
return { message };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactional-logger.js","sourceRoot":"","sources":["../src/transactional-logger.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"transactional-logger.js","sourceRoot":"","sources":["../src/transactional-logger.ts"],"names":[],"mappings":";;;AAEA,2EAA2E;AAC3E,+DAA+D;AAC/D,MAAa,sBAAsB;IACjC,YAAoB,MAAyB,EAAE,QAAgB;QAA3C,WAAM,GAAN,MAAM,CAAmB;QAC3C,IAAI,C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C;SAClC;IACH,CAAC;CACF;AAvCD,wDAuCC;AAED,MAAM,aAAa,GAAG,CAAC,GAAY,EAAE,OAAgB,EAAc,EAAE;IACnE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,EAAE;QACnC,OAAO,EAAE,OAAO,EAAE,CAAC;KACpB;IAED,IAAI,OAAO,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,EAAE;QACtC,OAAO,gBAAE,OAAO,IAAK,GAAG,CAAgB,CAAC;KAC1C;IAED,IACE,CAAC,CAAC,aAAa,IAAI,GAAG,CAAC;QACvB,CAAC,CAAC,eAAe,IAAI,GAAG,CAAC;QACzB,CAAC,CAAC,aAAa,IAAI,GAAG,CAAC;QACvB,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC;QACnB,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAC/B,CAAC,GAAG,CAAC,OAAO;QACZ,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,OAAO,CAAC,EAC3B;QACA,OAAO;YACL,OAAO,EAAE,GAA8B;YACvC,OAAO;SACR,CAAC;KACH;IAED,gEAAgE;IAChE,OAAO;QACL,OAAO,EAAE;YACP,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,aAAa,EAAE,GAAG,CAAC,aAAa;YAChC,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO;SAC7B;QACD,OAAO;KACM,CAAC;AAClB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-transactional-inbox-outbox",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "This library encapsulates the Mosaic based transactional inbox and outbox pattern",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"async-mutex": "^0.4.0",
|
|
35
35
|
"env-var": "^6.3.0",
|
|
36
36
|
"pg": "^8.11.3",
|
|
37
|
-
"pg-transactional-outbox": "
|
|
37
|
+
"pg-transactional-outbox": "0.4.0-beta.5"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/pg": "^8.6.1",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "0dc53b4b281f78d61be7d1547fa2a49576f51ef2"
|
|
51
51
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InboxConfig } from 'pg-transactional-outbox';
|
|
2
2
|
import { DbConfig, PG_TRANSACTIONAL_INBOX_PUBLICATION } from '../common';
|
|
3
3
|
|
|
4
|
-
export const getTransactionalInboxConfig = (
|
|
5
|
-
config: DbConfig,
|
|
6
|
-
): InboxServiceConfig => {
|
|
4
|
+
export const getTransactionalInboxConfig = (config: DbConfig): InboxConfig => {
|
|
7
5
|
return {
|
|
8
6
|
pgConfig: {
|
|
9
7
|
connectionString: config.dbEnvOwnerConnectionString,
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
InboxMessageHandler,
|
|
7
7
|
OutboxMessage,
|
|
8
8
|
getMaxAttempts,
|
|
9
|
-
logger,
|
|
10
9
|
} from 'pg-transactional-outbox';
|
|
11
10
|
import { DbConfig, Dict, InboxOutboxLogger } from '../common';
|
|
12
11
|
|
|
@@ -100,13 +99,10 @@ export abstract class TransactionalInboxMessageHandler<
|
|
|
100
99
|
_context?: TContext,
|
|
101
100
|
): Promise<'transient_error' | 'permanent_error'> {
|
|
102
101
|
if (attempts.current >= attempts.max) {
|
|
103
|
-
logger
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
`The final message handling attempt failed: ${error.message}`,
|
|
109
|
-
);
|
|
102
|
+
this.logger.error({
|
|
103
|
+
message: `The final message handling attempt failed: ${error.message}`,
|
|
104
|
+
details: { ...message, error },
|
|
105
|
+
});
|
|
110
106
|
return 'permanent_error';
|
|
111
107
|
}
|
|
112
108
|
return 'transient_error';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransactionalOutboxInboxConfig } from 'pg-transactional-outbox';
|
|
2
2
|
import { DbConfig, PG_TRANSACTIONAL_OUTBOX_PUBLICATION } from '../common';
|
|
3
3
|
|
|
4
4
|
export const getTransactionalOutboxConfig = (
|
|
5
5
|
config: DbConfig,
|
|
6
|
-
):
|
|
6
|
+
): TransactionalOutboxInboxConfig => {
|
|
7
7
|
return {
|
|
8
8
|
pgReplicationConfig: {
|
|
9
9
|
connectionString: config.dbOwnerReplicationConnectionString,
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { Broker } from '@axinom/mosaic-message-bus';
|
|
3
3
|
import {
|
|
4
4
|
OutboxMessage,
|
|
5
|
-
|
|
5
|
+
TransactionalLogger,
|
|
6
|
+
initializeOutboxListener,
|
|
6
7
|
} from 'pg-transactional-outbox';
|
|
7
8
|
import { DbConfig } from '../common';
|
|
8
9
|
import { StoreInboxMessage } from '../inbox';
|
|
@@ -40,11 +41,16 @@ const setupRabbitMqPublisher = async (
|
|
|
40
41
|
export const setupTransactionalOutboxMessageService = async (
|
|
41
42
|
config: DbConfig,
|
|
42
43
|
broker: Broker,
|
|
44
|
+
logger: TransactionalLogger,
|
|
43
45
|
): Promise<() => Promise<void>> => {
|
|
44
46
|
const outboxServiceConfig = getTransactionalOutboxConfig(config);
|
|
45
47
|
const [rmqPublisher] = await setupRabbitMqPublisher(broker);
|
|
46
48
|
|
|
47
|
-
const [shutdown] =
|
|
49
|
+
const [shutdown] = initializeOutboxListener(
|
|
50
|
+
outboxServiceConfig,
|
|
51
|
+
rmqPublisher,
|
|
52
|
+
logger,
|
|
53
|
+
);
|
|
48
54
|
|
|
49
55
|
return shutdown;
|
|
50
56
|
};
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import { setLogger } from 'pg-transactional-outbox';
|
|
2
1
|
import { InboxOutboxLogger, LogMessage } from './common';
|
|
3
2
|
|
|
4
|
-
export const setTransactionalLogger = (
|
|
5
|
-
logger: InboxOutboxLogger,
|
|
6
|
-
logLevel: string,
|
|
7
|
-
): void => {
|
|
8
|
-
setLogger(new TransactionalLogger(logger, logLevel));
|
|
9
|
-
};
|
|
10
|
-
|
|
11
3
|
// The pg-transactional-outbox library uses a central logger based in Pino.
|
|
12
4
|
// This logger matches the Mosaic based logger to the Pino one.
|
|
13
|
-
class
|
|
5
|
+
export class TransactionalLogMapper {
|
|
14
6
|
constructor(private logger: InboxOutboxLogger, logLevel: string) {
|
|
15
7
|
this.level = logLevel;
|
|
16
8
|
}
|