@nextage/era-lib 1.0.181 → 1.0.183
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/build/events/dlq-manager.d.ts +57 -0
- package/build/events/dlq-manager.d.ts.map +1 -0
- package/build/events/dlq-manager.js +206 -0
- package/build/events/dlq-manager.js.map +1 -0
- package/build/events/index.d.ts +1 -0
- package/build/events/index.d.ts.map +1 -1
- package/build/events/index.js +1 -0
- package/build/events/index.js.map +1 -1
- package/build/events/revocation-listener.d.ts.map +1 -1
- package/build/events/revocation-listener.js +12 -5
- package/build/events/revocation-listener.js.map +1 -1
- package/build/events/types/dlq.constants.d.ts +3 -0
- package/build/events/types/dlq.constants.d.ts.map +1 -1
- package/build/events/types/dlq.constants.js +7 -1
- package/build/events/types/dlq.constants.js.map +1 -1
- package/build/events/types/dlq.interfaces.d.ts +35 -0
- package/build/events/types/dlq.interfaces.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { NatsClientManager } from './nats-client-manager';
|
|
2
|
+
import { DlqDepth, DlqInspectItem } from './types/dlq.interfaces';
|
|
3
|
+
import { DlqInspectOptions, DlqManagerOptions } from './types/dlq.interfaces';
|
|
4
|
+
import { DlqReplayOptions, DlqReplayResult } from './types/dlq.interfaces';
|
|
5
|
+
export declare class DlqManager {
|
|
6
|
+
private readonly client;
|
|
7
|
+
private readonly alertThreshold;
|
|
8
|
+
private readonly monitorIntervalMs;
|
|
9
|
+
private readonly onAlert;
|
|
10
|
+
private timer?;
|
|
11
|
+
private checking;
|
|
12
|
+
constructor(client: NatsClientManager, opts?: DlqManagerOptions);
|
|
13
|
+
/**
|
|
14
|
+
* Current DLQ depth. `total` is the message count across the whole stream
|
|
15
|
+
* (or the count for `subject` when given); `bySubject` breaks it down per
|
|
16
|
+
* `dlq.<subject>` so an operator sees which consumer is failing.
|
|
17
|
+
*
|
|
18
|
+
* @param subject original subject (without the `dlq.` prefix); omit for all.
|
|
19
|
+
*/
|
|
20
|
+
depth(subject?: string): Promise<DlqDepth>;
|
|
21
|
+
/**
|
|
22
|
+
* Sample the depth once and fire `onAlert` (default: WARN log) when it exceeds
|
|
23
|
+
* the threshold. Returns the sampled depth; `-1` if a sample is already in
|
|
24
|
+
* flight (re-entrancy guard for the periodic timer).
|
|
25
|
+
*/
|
|
26
|
+
checkDepth(): Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Start the periodic depth monitor. Idempotent. The timer is `unref`ed so it
|
|
29
|
+
* never keeps the process alive on shutdown.
|
|
30
|
+
*/
|
|
31
|
+
startMonitor(): void;
|
|
32
|
+
/** Stop the periodic depth monitor (idempotent). */
|
|
33
|
+
stopMonitor(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Read up to `limit` parked messages WITHOUT removing them, so an operator can
|
|
36
|
+
* inspect payloads and errors before deciding to replay. Malformed envelopes
|
|
37
|
+
* are skipped. Idempotent: `Limits` retention means reading never deletes.
|
|
38
|
+
*/
|
|
39
|
+
inspect(opts?: DlqInspectOptions): Promise<DlqInspectItem[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Replay up to `limit` parked messages: re-publish each envelope's original
|
|
42
|
+
* payload to its original subject, then delete it from the DLQ by stream
|
|
43
|
+
* sequence. A message whose re-publish fails is left parked (`nak`) and
|
|
44
|
+
* reported in `failures`; the batch continues.
|
|
45
|
+
*/
|
|
46
|
+
replay(opts?: DlqReplayOptions): Promise<DlqReplayResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Create a short-lived, explicit-ack pull consumer over the DLQ stream filtered
|
|
49
|
+
* to `filter`. `deliver_policy: All` scans from the oldest parked message;
|
|
50
|
+
* `inactive_threshold` is a server-side safety net that reaps the consumer if
|
|
51
|
+
* this process dies mid-operation.
|
|
52
|
+
*/
|
|
53
|
+
private ephemeralConsumer;
|
|
54
|
+
private deleteConsumer;
|
|
55
|
+
private originalSubjectOf;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMapp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
+
"use strict";
|
|
2
|
+
/* ────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
* DLQ MANAGER — dead-letter observability & replay (Step 3.9)
|
|
4
|
+
*
|
|
5
|
+
* The failure path (Step 3.2) already parks poison messages on the `DLQ_EVENTS`
|
|
6
|
+
* stream: a message failing on `<subject>` is stored on `dlq.<subject>` as a
|
|
7
|
+
* `DeadLetterEnvelope` (original subject/stream/queue, delivery count, error,
|
|
8
|
+
* raw payload, timestamp) and dropped from its source stream. Until now the DLQ
|
|
9
|
+
* was only inspectable manually via the NATS CLI. This manager adds:
|
|
10
|
+
*
|
|
11
|
+
* • observability → periodic depth sampling that WARNs when parked messages
|
|
12
|
+
* pile up beyond a threshold, plus on-demand depth/inspect for an operator;
|
|
13
|
+
* • replay → re-publish a parked message's ORIGINAL payload back to its
|
|
14
|
+
* ORIGINAL subject once the bug is fixed, then delete it from the DLQ.
|
|
15
|
+
*
|
|
16
|
+
* Replay is safe: the re-published event re-enters the normal, version-guarded
|
|
17
|
+
* (Step 3.3) consumer path, so a duplicate delivery is idempotent. The DLQ
|
|
18
|
+
* stream uses `Limits` retention (ack does NOT delete), so replay removes a
|
|
19
|
+
* message EXPLICITLY by its stream sequence only AFTER the re-publish succeeds —
|
|
20
|
+
* a failed re-publish leaves the message parked (no loss).
|
|
21
|
+
* ──────────────────────────────────────────────────────────────────────────── */
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.DlqManager = void 0;
|
|
24
|
+
const nats_1 = require("nats");
|
|
25
|
+
const node_crypto_1 = require("node:crypto");
|
|
26
|
+
const nx_frame_be_1 = require("@nextage/nx-frame-be");
|
|
27
|
+
const dlq_constants_1 = require("./types/dlq.constants");
|
|
28
|
+
const dlq_constants_2 = require("./types/dlq.constants");
|
|
29
|
+
const dlq_constants_3 = require("./types/dlq.constants");
|
|
30
|
+
const dlq_constants_4 = require("./types/dlq.constants");
|
|
31
|
+
class DlqManager {
|
|
32
|
+
constructor(client, opts = {}) {
|
|
33
|
+
this.client = client;
|
|
34
|
+
this.checking = false;
|
|
35
|
+
this.alertThreshold = opts.alertThreshold ?? dlq_constants_2.DEFAULT_DLQ_ALERT_THRESHOLD;
|
|
36
|
+
this.monitorIntervalMs = opts.monitorIntervalMs ?? dlq_constants_3.DEFAULT_DLQ_MONITOR_INTERVAL_MS;
|
|
37
|
+
this.onAlert = opts.onAlert ?? ((depth, threshold) => nx_frame_be_1.APP.logger.warn(`⚠️ DLQ '${dlq_constants_1.DLQ_STREAM}' depth ${depth} exceeds threshold ${threshold} — inspect and replay once fixed`));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Current DLQ depth. `total` is the message count across the whole stream
|
|
41
|
+
* (or the count for `subject` when given); `bySubject` breaks it down per
|
|
42
|
+
* `dlq.<subject>` so an operator sees which consumer is failing.
|
|
43
|
+
*
|
|
44
|
+
* @param subject original subject (without the `dlq.` prefix); omit for all.
|
|
45
|
+
*/
|
|
46
|
+
async depth(subject) {
|
|
47
|
+
const filter = subject ? `${dlq_constants_1.DLQ_SUBJECT_PREFIX}${subject}` : dlq_constants_1.DLQ_SUBJECT_FILTER;
|
|
48
|
+
const info = await this.client.jetStreamManager.streams.info(dlq_constants_1.DLQ_STREAM, { subjects_filter: filter });
|
|
49
|
+
const bySubject = info.state.subjects ?? {};
|
|
50
|
+
const total = subject
|
|
51
|
+
? Object.values(bySubject).reduce((acc, n) => acc + n, 0)
|
|
52
|
+
: info.state.messages;
|
|
53
|
+
return { total, bySubject };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Sample the depth once and fire `onAlert` (default: WARN log) when it exceeds
|
|
57
|
+
* the threshold. Returns the sampled depth; `-1` if a sample is already in
|
|
58
|
+
* flight (re-entrancy guard for the periodic timer).
|
|
59
|
+
*/
|
|
60
|
+
async checkDepth() {
|
|
61
|
+
if (this.checking)
|
|
62
|
+
return -1;
|
|
63
|
+
this.checking = true;
|
|
64
|
+
try {
|
|
65
|
+
const { total } = await this.depth();
|
|
66
|
+
if (total > this.alertThreshold)
|
|
67
|
+
this.onAlert(total, this.alertThreshold);
|
|
68
|
+
return total;
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
this.checking = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Start the periodic depth monitor. Idempotent. The timer is `unref`ed so it
|
|
76
|
+
* never keeps the process alive on shutdown.
|
|
77
|
+
*/
|
|
78
|
+
startMonitor() {
|
|
79
|
+
if (this.timer)
|
|
80
|
+
return;
|
|
81
|
+
this.timer = setInterval(() => {
|
|
82
|
+
void this.checkDepth().catch(err => nx_frame_be_1.APP.logger.error('❌ DLQ depth monitor failed: %o', err));
|
|
83
|
+
}, this.monitorIntervalMs);
|
|
84
|
+
this.timer.unref?.();
|
|
85
|
+
nx_frame_be_1.APP.logger.info(`🩺 DLQ monitor started (every ${this.monitorIntervalMs}ms, threshold ${this.alertThreshold})`);
|
|
86
|
+
}
|
|
87
|
+
/** Stop the periodic depth monitor (idempotent). */
|
|
88
|
+
stopMonitor() {
|
|
89
|
+
if (!this.timer)
|
|
90
|
+
return;
|
|
91
|
+
clearInterval(this.timer);
|
|
92
|
+
this.timer = undefined;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Read up to `limit` parked messages WITHOUT removing them, so an operator can
|
|
96
|
+
* inspect payloads and errors before deciding to replay. Malformed envelopes
|
|
97
|
+
* are skipped. Idempotent: `Limits` retention means reading never deletes.
|
|
98
|
+
*/
|
|
99
|
+
async inspect(opts = {}) {
|
|
100
|
+
const limit = opts.limit ?? dlq_constants_4.DEFAULT_DLQ_REPLAY_LIMIT;
|
|
101
|
+
const filter = opts.subject ? `${dlq_constants_1.DLQ_SUBJECT_PREFIX}${opts.subject}` : dlq_constants_1.DLQ_SUBJECT_FILTER;
|
|
102
|
+
const items = [];
|
|
103
|
+
const { consumer, name } = await this.ephemeralConsumer(filter);
|
|
104
|
+
try {
|
|
105
|
+
const iter = await consumer.fetch({ max_messages: limit, expires: 5000 });
|
|
106
|
+
for await (const msg of iter) {
|
|
107
|
+
try {
|
|
108
|
+
const env = msg.json();
|
|
109
|
+
items.push({
|
|
110
|
+
streamSequence: msg.seq,
|
|
111
|
+
originalSubject: env.originalSubject,
|
|
112
|
+
deliveryCount: env.deliveryCount,
|
|
113
|
+
error: env.error,
|
|
114
|
+
timestamp: env.timestamp,
|
|
115
|
+
data: env.data,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
catch { /* skip a malformed envelope but keep scanning */ }
|
|
119
|
+
// Ack keeps the ephemeral consumer tidy; with `Limits` retention it does
|
|
120
|
+
// NOT delete the stream message, so inspect stays non-destructive.
|
|
121
|
+
msg.ack();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
await this.deleteConsumer(name);
|
|
126
|
+
}
|
|
127
|
+
return items;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Replay up to `limit` parked messages: re-publish each envelope's original
|
|
131
|
+
* payload to its original subject, then delete it from the DLQ by stream
|
|
132
|
+
* sequence. A message whose re-publish fails is left parked (`nak`) and
|
|
133
|
+
* reported in `failures`; the batch continues.
|
|
134
|
+
*/
|
|
135
|
+
async replay(opts = {}) {
|
|
136
|
+
const limit = opts.limit ?? dlq_constants_4.DEFAULT_DLQ_REPLAY_LIMIT;
|
|
137
|
+
const filter = opts.subject ? `${dlq_constants_1.DLQ_SUBJECT_PREFIX}${opts.subject}` : dlq_constants_1.DLQ_SUBJECT_FILTER;
|
|
138
|
+
const result = { replayed: 0, failed: 0, failures: [] };
|
|
139
|
+
const { consumer, name } = await this.ephemeralConsumer(filter);
|
|
140
|
+
try {
|
|
141
|
+
const iter = await consumer.fetch({ max_messages: limit, expires: 5000 });
|
|
142
|
+
for await (const msg of iter) {
|
|
143
|
+
const seq = msg.seq;
|
|
144
|
+
try {
|
|
145
|
+
const env = msg.json();
|
|
146
|
+
// Re-publish FIRST; only remove from the DLQ once it is safely back on
|
|
147
|
+
// the source subject (delete-after-publish → no loss on failure).
|
|
148
|
+
await this.client.publish(env.originalSubject, env.data);
|
|
149
|
+
await this.client.jetStreamManager.streams.deleteMessage(dlq_constants_1.DLQ_STREAM, seq);
|
|
150
|
+
msg.ack();
|
|
151
|
+
result.replayed++;
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
msg.nak(); // leave it parked for a later attempt
|
|
155
|
+
result.failed++;
|
|
156
|
+
result.failures.push({
|
|
157
|
+
streamSequence: seq,
|
|
158
|
+
originalSubject: this.originalSubjectOf(msg.subject),
|
|
159
|
+
error: err instanceof Error ? err.message : String(err),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
await this.deleteConsumer(name);
|
|
166
|
+
}
|
|
167
|
+
if (result.replayed) {
|
|
168
|
+
const scope = opts.subject ? ` for '${opts.subject}'` : '';
|
|
169
|
+
nx_frame_be_1.APP.logger.info(`♻️ DLQ replay: ${result.replayed} message(s) re-published${scope}, ${result.failed} failed`);
|
|
170
|
+
}
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
// ── internals ────────────────────────────────────────────────────────────────
|
|
174
|
+
/**
|
|
175
|
+
* Create a short-lived, explicit-ack pull consumer over the DLQ stream filtered
|
|
176
|
+
* to `filter`. `deliver_policy: All` scans from the oldest parked message;
|
|
177
|
+
* `inactive_threshold` is a server-side safety net that reaps the consumer if
|
|
178
|
+
* this process dies mid-operation.
|
|
179
|
+
*/
|
|
180
|
+
async ephemeralConsumer(filter) {
|
|
181
|
+
const name = `dlq_admin_${process.pid}_${(0, node_crypto_1.randomUUID)().slice(0, 8)}`;
|
|
182
|
+
const config = {
|
|
183
|
+
name,
|
|
184
|
+
ack_policy: nats_1.AckPolicy.Explicit,
|
|
185
|
+
filter_subject: filter,
|
|
186
|
+
deliver_policy: nats_1.DeliverPolicy.All,
|
|
187
|
+
inactive_threshold: 30 * 1000000000, // 30s in ns → auto-reap on crash
|
|
188
|
+
};
|
|
189
|
+
await this.client.jetStreamManager.consumers.add(dlq_constants_1.DLQ_STREAM, config);
|
|
190
|
+
const consumer = await this.client.jetStream.consumers.get(dlq_constants_1.DLQ_STREAM, name);
|
|
191
|
+
return { consumer, name };
|
|
192
|
+
}
|
|
193
|
+
async deleteConsumer(name) {
|
|
194
|
+
try {
|
|
195
|
+
await this.client.jetStreamManager.consumers.delete(dlq_constants_1.DLQ_STREAM, name);
|
|
196
|
+
}
|
|
197
|
+
catch { /* already reaped by the server — nothing to do */ }
|
|
198
|
+
}
|
|
199
|
+
originalSubjectOf(dlqSubject) {
|
|
200
|
+
return dlqSubject.startsWith(dlq_constants_1.DLQ_SUBJECT_PREFIX)
|
|
201
|
+
? dlqSubject.slice(dlq_constants_1.DLQ_SUBJECT_PREFIX.length)
|
|
202
|
+
: dlqSubject;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.DlqManager = DlqManager;
|
|
206
|
+
//# sourceMappingURL=dlq-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dlq-manager.js","sourceRoot":"","sources":["../../src/events/dlq-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;kFAmBkF;;;AAElF,+BAA0E;AAC1E,6CAAiF;AACjF,sDAA0F;AAK1F,yDAA2F;AAC3F,yDAA2F;AAC3F,yDAA2F;AAC3F,yDAA2F;AAE3F,MAAa,UAAU;IASrB,YAA6B,MAAyB,EAAE,OAA0B,EAAE;QAAvD,WAAM,GAAN,MAAM,CAAmB;QAF9C,aAAQ,GAAG,KAAK,CAAC;QAIvB,IAAI,CAAC,cAAc,GAAM,IAAI,CAAC,cAAc,IAAO,2CAA2B,CAAC;QAC/E,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,IAAI,+CAA+B,CAAC;QACnF,IAAI,CAAC,OAAO,GAAa,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B;QAE1C,OAAO,UAAU,CAAC,UAAU,CAAC,kCAAkB,CAAC;YAC9C,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,kCAAkB,CAAC,MAAM,CAAC;YAC7C,CAAC,CAAC,UAAU,CAAC;IACjB,CAAC;CACF;AA5ND,gCA4NC"}
|
package/build/events/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from './nats-client-manager';
|
|
|
18
18
|
export * from './nats-wrapper';
|
|
19
19
|
export * from './base-nats-listener';
|
|
20
20
|
export * from './base-nats-publisher';
|
|
21
|
+
export * from './dlq-manager';
|
|
21
22
|
export * from './organization';
|
|
22
23
|
export * from './user';
|
|
23
24
|
export * from './analysis-type';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAG9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AAGvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAGhC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
package/build/events/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __exportStar(require("./nats-client-manager"), exports);
|
|
|
36
36
|
__exportStar(require("./nats-wrapper"), exports);
|
|
37
37
|
__exportStar(require("./base-nats-listener"), exports);
|
|
38
38
|
__exportStar(require("./base-nats-publisher"), exports);
|
|
39
|
+
__exportStar(require("./dlq-manager"), exports);
|
|
39
40
|
// admin-mng
|
|
40
41
|
__exportStar(require("./organization"), exports);
|
|
41
42
|
__exportStar(require("./user"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+CAA6B;AAC7B,0CAAwB;AAExB,0DAAwC;AACxC,4CAA0B;AAC1B,gDAA8B;AAC9B,8CAA4B;AAC5B,2CAAyB;AACzB,uDAAqC;AACrC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAE3C,qBAAqB;AACrB,uDAAqC;AACrC,gDAA8B;AAC9B,kDAAgC;AAChC,mDAAiC;AAEjC,mBAAmB;AACnB,wDAAsC;AACtC,iDAA+B;AAC/B,uDAAqC;AACrC,wDAAsC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+CAA6B;AAC7B,0CAAwB;AAExB,0DAAwC;AACxC,4CAA0B;AAC1B,gDAA8B;AAC9B,8CAA4B;AAC5B,2CAAyB;AACzB,uDAAqC;AACrC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAE3C,qBAAqB;AACrB,uDAAqC;AACrC,gDAA8B;AAC9B,kDAAgC;AAChC,mDAAiC;AAEjC,mBAAmB;AACnB,wDAAsC;AACtC,iDAA+B;AAC/B,uDAAqC;AACrC,wDAAsC;AACtC,gDAA8B;AAE9B,YAAY;AACZ,iDAA+B;AAC/B,yCAAuB;AAEvB,aAAa;AACb,kDAAgC;AAChC,gDAA8B;AAC9B,6CAA2B;AAC3B,mDAAiC;AACjC,iDAA+B;AAC/B,4CAA0B;AAC1B,sDAAoC;AACpC,2CAAyB;AACzB,kDAAgC;AAEhC,cAAc;AACd,4CAA0B;AAC1B,kDAAgC;AAChC,oDAAkC;AAClC,qDAAmC;AACnC,qDAAmC;AACnC,oDAAkC;AAClC,iDAA+B;AAC/B,mDAAiC;AAEjC,oBAAoB;AACpB,kDAAgC;AAChC,+CAA6B;AAE7B,kBAAkB;AAClB,mCAAmC;AAEnC,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation-listener.d.ts","sourceRoot":"","sources":["../../src/events/revocation-listener.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,cAAc,EAAE,MAAoB,cAAc,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAiB,uBAAuB,CAAC;AAIrE,OAAO,EAAE,yBAAyB,EAAE,MAAS,+BAA+B,CAAC;AAM7E,UAAU,YAAa,SAAQ,cAAc;IAC3C,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;CACpC;AAED,qBAAa,kBAAkB;IAQjB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IANrC,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,SAAS,CAAU;IAE3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;gBAEvB,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,yBAA8B;IAMzF;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YAQf,OAAO;
|
|
1
|
+
{"version":3,"file":"revocation-listener.d.ts","sourceRoot":"","sources":["../../src/events/revocation-listener.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,cAAc,EAAE,MAAoB,cAAc,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAiB,uBAAuB,CAAC;AAIrE,OAAO,EAAE,yBAAyB,EAAE,MAAS,+BAA+B,CAAC;AAM7E,UAAU,YAAa,SAAQ,cAAc;IAC3C,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;CACpC;AAED,qBAAa,kBAAkB;IAQjB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IANrC,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,SAAS,CAAU;IAE3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;gBAEvB,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,yBAA8B;IAMzF;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YAQf,OAAO;IA+BrB,OAAO,CAAC,MAAM;IAkBd,yDAAyD;IACnD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAc5B"}
|
|
@@ -49,10 +49,16 @@ class RevocationListener {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
catch (err) {
|
|
52
|
+
// A failure raised while we are tearing down (`stop()` already set
|
|
53
|
+
// `listening = false`) is the expected consequence of the closing NATS
|
|
54
|
+
// connection (CONNECTION_CLOSED) — not a fault. Stay silent and do not
|
|
55
|
+
// reschedule. Only surface/retry errors that happen while we still intend
|
|
56
|
+
// to listen (e.g. a broker hiccup during normal operation).
|
|
57
|
+
if (!this.listening)
|
|
58
|
+
return;
|
|
52
59
|
this.onError(err);
|
|
53
60
|
// Best-effort: retry the consume loop after a short delay while listening.
|
|
54
|
-
|
|
55
|
-
setTimeout(() => void this.consume(), 5000);
|
|
61
|
+
setTimeout(() => void this.consume(), 5000);
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
64
|
handle(msg) {
|
|
@@ -71,12 +77,13 @@ class RevocationListener {
|
|
|
71
77
|
/** Stop draining (graceful shutdown / test teardown). */
|
|
72
78
|
async stop() {
|
|
73
79
|
this.listening = false;
|
|
80
|
+
// Best-effort delete: during graceful shutdown the NATS connection may already
|
|
81
|
+
// be closing (CONNECTION_CLOSED) — harmless, the ephemeral consumer is reaped
|
|
82
|
+
// by its `inactive_threshold` anyway. A teardown error is never surfaced.
|
|
74
83
|
try {
|
|
75
84
|
await this.consumer?.delete();
|
|
76
85
|
}
|
|
77
|
-
catch
|
|
78
|
-
this.onError(err);
|
|
79
|
-
}
|
|
86
|
+
catch { /* teardown — ignore */ }
|
|
80
87
|
this.consumer = undefined;
|
|
81
88
|
nx_frame_be_1.APP.logger.info('🔒 Revocation listener stopped');
|
|
82
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation-listener.js","sourceRoot":"","sources":["../../src/events/revocation-listener.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;kFAakF;;;AAElF,sDAAoE;AAIpE,uCAAyD;AACzD,+DAAqE;AAGrE,uEAA4E;AAC5E,yCAA6D;AAQ7D,MAAa,kBAAkB;IAQ7B,YAA6B,QAAsB,EAAE,OAAkC,EAAE;QAA5D,aAAQ,GAAR,QAAQ,CAAc;QAL3C,cAAS,GAAI,KAAK,CAAC;QAOzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GAAM,IAAI,CAAC,OAAO,IAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM;QAEV,IAAI,CAAC,QAAQ,GAAI,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,kBAAkB,CAAC,gBAAQ,CAAC,aAAa,EAAE,oCAAa,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACvI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,OAAO;QAEnB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO;QAE3B,IAAI,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAE/C,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAEjC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CAAC,CAAC,uBAAuB,CAAC,CAAC;QAEjC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAE1B,iBAAG,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;CACF;AA3FD,gDA2FC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare const DLQ_STREAM = "DLQ_EVENTS";
|
|
2
2
|
export declare const DLQ_SUBJECT_PREFIX = "dlq.";
|
|
3
3
|
export declare const DLQ_SUBJECT_FILTER = "dlq.>";
|
|
4
|
+
export declare const DEFAULT_DLQ_ALERT_THRESHOLD = 50;
|
|
5
|
+
export declare const DEFAULT_DLQ_MONITOR_INTERVAL_MS = 60000;
|
|
6
|
+
export declare const DEFAULT_DLQ_REPLAY_LIMIT = 100;
|
|
4
7
|
//# sourceMappingURL=dlq.constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlq.constants.d.ts","sourceRoot":"","sources":["../../../src/events/types/dlq.constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,eAAuB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC,eAAO,MAAM,kBAAkB,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"dlq.constants.d.ts","sourceRoot":"","sources":["../../../src/events/types/dlq.constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,eAAuB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAK1C,eAAO,MAAM,2BAA2B,KAAS,CAAC;AAClD,eAAO,MAAM,+BAA+B,QAAS,CAAC;AACtD,eAAO,MAAM,wBAAwB,MAAa,CAAC"}
|
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
// provisions the DLQ stream. Kept here so producer and stream config cannot
|
|
5
5
|
// drift apart.
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DLQ_SUBJECT_FILTER = exports.DLQ_SUBJECT_PREFIX = exports.DLQ_STREAM = void 0;
|
|
7
|
+
exports.DEFAULT_DLQ_REPLAY_LIMIT = exports.DEFAULT_DLQ_MONITOR_INTERVAL_MS = exports.DEFAULT_DLQ_ALERT_THRESHOLD = exports.DLQ_SUBJECT_FILTER = exports.DLQ_SUBJECT_PREFIX = exports.DLQ_STREAM = void 0;
|
|
8
8
|
exports.DLQ_STREAM = 'DLQ_EVENTS';
|
|
9
9
|
exports.DLQ_SUBJECT_PREFIX = 'dlq.'; // a failed `<subject>` parks on `dlq.<subject>`
|
|
10
10
|
exports.DLQ_SUBJECT_FILTER = 'dlq.>'; // wildcard binding every `dlq.*` to the stream
|
|
11
|
+
// DLQ observability & replay (step 3.9). The manager periodically samples the
|
|
12
|
+
// stream depth and warns when parked messages pile up, and replays parked
|
|
13
|
+
// messages back to their original subject once the underlying bug is fixed.
|
|
14
|
+
exports.DEFAULT_DLQ_ALERT_THRESHOLD = 50; // WARN once depth exceeds this
|
|
15
|
+
exports.DEFAULT_DLQ_MONITOR_INTERVAL_MS = 60000; // 60s periodic depth sample
|
|
16
|
+
exports.DEFAULT_DLQ_REPLAY_LIMIT = 100; // max messages handled per replay/inspect call
|
|
11
17
|
//# sourceMappingURL=dlq.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlq.constants.js","sourceRoot":"","sources":["../../../src/events/types/dlq.constants.ts"],"names":[],"mappings":";AAAA,4EAA4E;AAC5E,wEAAwE;AACxE,4EAA4E;AAC5E,eAAe;;;AAEF,QAAA,UAAU,GAAW,YAAY,CAAC;AAClC,QAAA,kBAAkB,GAAG,MAAM,CAAC,CAAG,gDAAgD;AAC/E,QAAA,kBAAkB,GAAG,OAAO,CAAC,CAAE,+CAA+C"}
|
|
1
|
+
{"version":3,"file":"dlq.constants.js","sourceRoot":"","sources":["../../../src/events/types/dlq.constants.ts"],"names":[],"mappings":";AAAA,4EAA4E;AAC5E,wEAAwE;AACxE,4EAA4E;AAC5E,eAAe;;;AAEF,QAAA,UAAU,GAAW,YAAY,CAAC;AAClC,QAAA,kBAAkB,GAAG,MAAM,CAAC,CAAG,gDAAgD;AAC/E,QAAA,kBAAkB,GAAG,OAAO,CAAC,CAAE,+CAA+C;AAE3F,8EAA8E;AAC9E,0EAA0E;AAC1E,4EAA4E;AAC/D,QAAA,2BAA2B,GAAO,EAAE,CAAC,CAAK,+BAA+B;AACzE,QAAA,+BAA+B,GAAG,KAAM,CAAC,CAAC,4BAA4B;AACtE,QAAA,wBAAwB,GAAU,GAAG,CAAC,CAAI,+CAA+C"}
|
|
@@ -7,4 +7,39 @@ export interface DeadLetterEnvelope {
|
|
|
7
7
|
data: string;
|
|
8
8
|
timestamp: string;
|
|
9
9
|
}
|
|
10
|
+
export interface DlqDepth {
|
|
11
|
+
total: number;
|
|
12
|
+
bySubject: Record<string, number>;
|
|
13
|
+
}
|
|
14
|
+
export interface DlqReplayOptions {
|
|
15
|
+
subject?: string;
|
|
16
|
+
limit?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface DlqInspectOptions {
|
|
19
|
+
subject?: string;
|
|
20
|
+
limit?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface DlqInspectItem {
|
|
23
|
+
streamSequence: number;
|
|
24
|
+
originalSubject: string;
|
|
25
|
+
deliveryCount: number;
|
|
26
|
+
error: string;
|
|
27
|
+
timestamp: string;
|
|
28
|
+
data: string;
|
|
29
|
+
}
|
|
30
|
+
export interface DlqReplayFailure {
|
|
31
|
+
streamSequence: number;
|
|
32
|
+
originalSubject: string;
|
|
33
|
+
error: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DlqReplayResult {
|
|
36
|
+
replayed: number;
|
|
37
|
+
failed: number;
|
|
38
|
+
failures: DlqReplayFailure[];
|
|
39
|
+
}
|
|
40
|
+
export interface DlqManagerOptions {
|
|
41
|
+
alertThreshold?: number;
|
|
42
|
+
monitorIntervalMs?: number;
|
|
43
|
+
onAlert?: (depth: number, threshold: number) => void;
|
|
44
|
+
}
|
|
10
45
|
//# sourceMappingURL=dlq.interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlq.interfaces.d.ts","sourceRoot":"","sources":["../../../src/events/types/dlq.interfaces.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAO,MAAM,CAAC;IACxB,cAAc,EAAG,MAAM,CAAC;IACxB,aAAa,EAAI,MAAM,CAAC;IACxB,KAAK,EAAY,MAAM,CAAC;IACxB,IAAI,EAAa,MAAM,CAAC;IACxB,SAAS,EAAQ,MAAM,CAAC;CACzB"}
|
|
1
|
+
{"version":3,"file":"dlq.interfaces.d.ts","sourceRoot":"","sources":["../../../src/events/types/dlq.interfaces.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAO,MAAM,CAAC;IACxB,cAAc,EAAG,MAAM,CAAC;IACxB,aAAa,EAAI,MAAM,CAAC;IACxB,KAAK,EAAY,MAAM,CAAC;IACxB,IAAI,EAAa,MAAM,CAAC;IACxB,SAAS,EAAQ,MAAM,CAAC;CACzB;AAMD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAM,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAID,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAI,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAI,MAAM,CAAC;CAClB;AAID,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAG,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAA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