@ddd-ts-kit/rabbitmq 0.114.1 → 0.116.0
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/README.fr.md +29 -5
- package/README.md +26 -4
- package/dist/connection/answered-within.d.ts +7 -0
- package/dist/connection/answered-within.d.ts.map +1 -0
- package/dist/connection/answered-within.js +16 -0
- package/dist/connection/answered-within.js.map +1 -0
- package/dist/connection/broker-link.d.ts +8 -1
- package/dist/connection/broker-link.d.ts.map +1 -1
- package/dist/connection/broker-link.js +22 -8
- package/dist/connection/broker-link.js.map +1 -1
- package/dist/connection/deadline.d.ts +13 -0
- package/dist/connection/deadline.d.ts.map +1 -0
- package/dist/connection/deadline.js +22 -0
- package/dist/connection/deadline.js.map +1 -0
- package/dist/connection/opened-within.d.ts +9 -0
- package/dist/connection/opened-within.d.ts.map +1 -0
- package/dist/connection/opened-within.js +9 -0
- package/dist/connection/opened-within.js.map +1 -0
- package/dist/connection/within.d.ts +4 -3
- package/dist/connection/within.d.ts.map +1 -1
- package/dist/connection/within.js +10 -4
- package/dist/connection/within.js.map +1 -1
- package/dist/consumption/consumption.d.ts +18 -3
- package/dist/consumption/consumption.d.ts.map +1 -1
- package/dist/consumption/consumption.js +26 -11
- package/dist/consumption/consumption.js.map +1 -1
- package/dist/errors/connection-failure-code.d.ts +3 -0
- package/dist/errors/connection-failure-code.d.ts.map +1 -0
- package/dist/errors/connection-failure-code.js +7 -0
- package/dist/errors/connection-failure-code.js.map +1 -0
- package/dist/options/rabbit-mq-event-bus-options.d.ts +10 -2
- package/dist/options/rabbit-mq-event-bus-options.d.ts.map +1 -1
- package/dist/options/settings-of.d.ts.map +1 -1
- package/dist/options/settings-of.js +5 -13
- package/dist/options/settings-of.js.map +1 -1
- package/dist/options/settings.d.ts +1 -0
- package/dist/options/settings.d.ts.map +1 -1
- package/dist/publication/confirmations.d.ts +24 -0
- package/dist/publication/confirmations.d.ts.map +1 -0
- package/dist/publication/confirmations.js +53 -0
- package/dist/publication/confirmations.js.map +1 -0
- package/dist/publication/publications.d.ts +6 -3
- package/dist/publication/publications.d.ts.map +1 -1
- package/dist/publication/publications.js +18 -34
- package/dist/publication/publications.js.map +1 -1
- package/dist/rabbit-mq-event-bus.d.ts +8 -2
- package/dist/rabbit-mq-event-bus.d.ts.map +1 -1
- package/dist/rabbit-mq-event-bus.js +41 -17
- package/dist/rabbit-mq-event-bus.js.map +1 -1
- package/package.json +4 -4
- package/dist/publication/send-confirmed.d.ts +0 -5
- package/dist/publication/send-confirmed.d.ts.map +0 -1
- package/dist/publication/send-confirmed.js +0 -21
- package/dist/publication/send-confirmed.js.map +0 -1
package/README.fr.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](README.md) · **Français**
|
|
2
|
-
<!-- translation-of: README.md sha256:
|
|
2
|
+
<!-- translation-of: README.md sha256:c19971720eedb1d3 -->
|
|
3
3
|
|
|
4
4
|
# @ddd-ts-kit/rabbitmq
|
|
5
5
|
|
|
@@ -261,7 +261,13 @@ Deux instances d'un même consommateur partagent sa file : chaque événement va
|
|
|
261
261
|
`occurredAt`, ou avec un `tenantId` que `isTenantId` du noyau refuse) est empoisonné (poison) :
|
|
262
262
|
il va directement dans la file de rejet avec `x-dead-reason: poison` et
|
|
263
263
|
`x-error-code: POISON_MESSAGE`, et aucun gestionnaire ne le voit.
|
|
264
|
-
5.
|
|
264
|
+
5. Un message qui atteint un consommateur dont tous les gestionnaires se sont désabonnés (il
|
|
265
|
+
était en route quand le dernier est parti) attend le prochain gestionnaire : le bus l'envoie
|
|
266
|
+
dans la file de nouvelles tentatives avec son `x-attempt` inchangé, si bien qu'il revient après
|
|
267
|
+
`retry.delayMs`, jamais sur-le-champ, ne compte pour aucune tentative et ne va jamais dans la
|
|
268
|
+
file de rejet pour cela. Les quatre brokers du kit gardent un tel message pour le prochain
|
|
269
|
+
gestionnaire.
|
|
270
|
+
6. Seuls des codes voyagent : `x-error-code` est le `code` de l'erreur ou le nom de sa classe. Le
|
|
265
271
|
message d'une erreur n'est jamais journalisé, remonté ni joint, car il peut citer des données
|
|
266
272
|
du *payload*.
|
|
267
273
|
|
|
@@ -347,9 +353,27 @@ liées, et la file de travail continue de se remplir.
|
|
|
347
353
|
- **`onUnroutable: 'fail'`** rejette un événement pour lequel aucune file n'est liée ; derrière le
|
|
348
354
|
relais de l'outbox, un tel enregistrement est retenté, puis passe à l'état mort (*dead*). Ne
|
|
349
355
|
l'utilisez que lorsqu'un consommateur manquant est un incident.
|
|
350
|
-
- **`publishTimeoutMs`** (30000 par défaut)
|
|
351
|
-
|
|
352
|
-
|
|
356
|
+
- **`publishTimeoutMs`** (30000 par défaut) borne `publish`, ouverture de la connexion et
|
|
357
|
+
déclaration de ses propres files comprises : une seule échéance pour l'appel, pas une par étape.
|
|
358
|
+
Une publication que le *broker* n'a pas confirmée d'ici là est rejetée avec
|
|
359
|
+
`PUBLISH_NOT_CONFIRMED`, comme sur NATS et Kafka, et une publication retenue avant son envoi avec
|
|
360
|
+
`BROKER_UNAVAILABLE` de raison `REQUEST_TIMEOUT` (comme sur Kafka), si bien que le relais la
|
|
361
|
+
retente au lieu d'attendre un *broker* bloqué.
|
|
362
|
+
La même borne vaut pour la copie d'un message en échec vers sa file de nouvelles tentatives ou
|
|
363
|
+
sa file de rejet, le message étant alors rendu à sa file de travail, et pour chaque attente de
|
|
364
|
+
`replayDead`, qui est alors rejeté et laisse le message dans la file de rejet : avec
|
|
365
|
+
`PUBLISH_NOT_CONFIRMED` pour une copie, et avec `BROKER_UNAVAILABLE` de raison
|
|
366
|
+
`REQUEST_TIMEOUT` quand le *broker* n'ouvre pas son canal ou ne remet pas le message de rejet
|
|
367
|
+
suivant à temps. `close()` n'attend jamais plus longtemps une réponse du *broker*, fermeture de
|
|
368
|
+
la connexion comprise.
|
|
369
|
+
- **`connectTimeoutMs`** (10000 par défaut), comme sur Kafka, borne une connexion et une requête
|
|
370
|
+
d'administration. Une tentative d'ouverture de la connexion que le *broker* ne mène pas à terme
|
|
371
|
+
à temps (il accepte la connexion et ne répond jamais en AMQP, ou n'ouvre jamais un canal, ou ne
|
|
372
|
+
répond pas à une déclaration) échoue, est signalée à `onFailure` comme `REQUEST_TIMEOUT` et est
|
|
373
|
+
retentée avec les délais de `reconnect` ; de même pour le démarrage d'un abonnement dont le
|
|
374
|
+
*broker* ne répond jamais aux déclarations. `assertTopology` se conclut dans ce délai, quel que
|
|
375
|
+
soit le nombre de ses déclarations, et rejette avec la même raison. Une connexion ou un canal
|
|
376
|
+
que le *broker* ouvre après ce délai est fermé dès son arrivée.
|
|
353
377
|
- **Un consommateur qui plante en plein gestionnaire** récupère ses messages sans que `x-attempt`
|
|
354
378
|
soit incrémenté. Les files quorum bornent cela par leur limite de livraisons, au-delà de
|
|
355
379
|
laquelle le *broker* envoie le message dans la file de rejet ; les files classiques ne le
|
package/README.md
CHANGED
|
@@ -254,7 +254,12 @@ one consumer share its queue: each event goes to one of them.
|
|
|
254
254
|
`occurredAt`, or with a `tenantId` that `isTenantId` of the kernel refuses) is poison: it
|
|
255
255
|
goes straight to the dead queue with `x-dead-reason: poison` and
|
|
256
256
|
`x-error-code: POISON_MESSAGE`, and no handler sees it.
|
|
257
|
-
5.
|
|
257
|
+
5. A message that reaches a consumer whose handlers all unsubscribed (it was on its way when
|
|
258
|
+
the last one left) waits for the next handler: the bus sends it to the retry queue with its
|
|
259
|
+
`x-attempt` unchanged, so it comes back after `retry.delayMs`, never on the spot, counts as no
|
|
260
|
+
attempt and never goes to the dead queue for it. The four brokers of the kit keep such a
|
|
261
|
+
message for the next handler.
|
|
262
|
+
6. Only codes travel: `x-error-code` is the `code` of the error or its class name. The message
|
|
258
263
|
of an error is never logged, reported or attached, because it may quote payload data.
|
|
259
264
|
|
|
260
265
|
Delivery is at least once and unordered. The copy-then-acknowledge order means a crash in
|
|
@@ -333,9 +338,26 @@ the work queue keeps filling.
|
|
|
333
338
|
taken by the broker. The relay publishes one by one and retries, consumers deduplicate.
|
|
334
339
|
- **`onUnroutable: 'fail'`** rejects an event no queue is bound for; behind the outbox relay
|
|
335
340
|
such a record is retried, then dead. Use it only when a missing consumer is an incident.
|
|
336
|
-
- **`publishTimeoutMs`** (default 30000)
|
|
337
|
-
|
|
338
|
-
|
|
341
|
+
- **`publishTimeoutMs`** (default 30000) bounds `publish`, the opening of the connection and the
|
|
342
|
+
declaration of its own queues included: one deadline for the call, not one per step. A
|
|
343
|
+
publication the broker has not confirmed by then is rejected with `PUBLISH_NOT_CONFIRMED`, as on
|
|
344
|
+
NATS and Kafka, and one held up before it was sent with `BROKER_UNAVAILABLE` of reason
|
|
345
|
+
`REQUEST_TIMEOUT` (as on Kafka), so the relay retries it instead of waiting for a broker that
|
|
346
|
+
stalled.
|
|
347
|
+
The same bound holds for the copy of a failed message to its retry or dead queue, which is then
|
|
348
|
+
handed back to its work queue, and for each wait of `replayDead`, which then rejects and leaves
|
|
349
|
+
the message in the dead queue: with `PUBLISH_NOT_CONFIRMED` for a copy, and with
|
|
350
|
+
`BROKER_UNAVAILABLE` of reason `REQUEST_TIMEOUT` when the broker does not open its channel or
|
|
351
|
+
hand over the next dead message in time. `close()` never waits longer than that for an answer
|
|
352
|
+
of the broker, the close of the connection included.
|
|
353
|
+
- **`connectTimeoutMs`** (default 10000), as on Kafka, bounds a connection and an administrative
|
|
354
|
+
request. An attempt to open the connection that the broker does not finish in time (it accepts
|
|
355
|
+
the connection and never answers AMQP, or never opens a channel or answers a declaration)
|
|
356
|
+
fails, is reported to `onFailure` as `REQUEST_TIMEOUT` and is retried with the delays of
|
|
357
|
+
`reconnect`; so is the start of a subscription whose declarations the broker never answers.
|
|
358
|
+
`assertTopology` settles within it, however many declarations it makes, and rejects with the
|
|
359
|
+
same reason. A connection or a channel the broker opens after its timeout is closed when it
|
|
360
|
+
arrives.
|
|
339
361
|
- **A consumer that crashes mid-handler** gets its messages back without `x-attempt` being
|
|
340
362
|
incremented. Quorum queues bound that with their delivery limit, after which the message is
|
|
341
363
|
dead-lettered to the dead queue by the broker; classic queues do not bound it. This path is
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the broker answered to `request` within `ms`. Rejects with `BrokerUnavailableError`
|
|
3
|
+
* (`REQUEST_TIMEOUT`) when no answer came in time, as on Kafka: a request to a stalled broker fails.
|
|
4
|
+
* An answer that comes later is handed to `late`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function answeredWithin<T>(ms: number, request: Promise<T>, late?: (answer: T) => unknown): Promise<T>;
|
|
7
|
+
//# sourceMappingURL=answered-within.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answered-within.d.ts","sourceRoot":"","sources":["../../src/connection/answered-within.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,IAAI,GAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAgB,GACpC,OAAO,CAAC,CAAC,CAAC,CAQZ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BrokerUnavailableError } from '../errors/broker-unavailable-error.js';
|
|
2
|
+
import { ignore } from '../ignore.js';
|
|
3
|
+
import { within } from './within.js';
|
|
4
|
+
/**
|
|
5
|
+
* What the broker answered to `request` within `ms`. Rejects with `BrokerUnavailableError`
|
|
6
|
+
* (`REQUEST_TIMEOUT`) when no answer came in time, as on Kafka: a request to a stalled broker fails.
|
|
7
|
+
* An answer that comes later is handed to `late`.
|
|
8
|
+
*/
|
|
9
|
+
export async function answeredWithin(ms, request, late = ignore) {
|
|
10
|
+
if (!(await within(ms, request))) {
|
|
11
|
+
void request.then(late).catch(ignore);
|
|
12
|
+
throw new BrokerUnavailableError('REQUEST_TIMEOUT');
|
|
13
|
+
}
|
|
14
|
+
return request;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=answered-within.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answered-within.js","sourceRoot":"","sources":["../../src/connection/answered-within.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,EAAU,EACV,OAAmB,EACnB,IAAI,GAA2B,MAAM;IAErC,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;QACjC,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEtC,MAAM,IAAI,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -11,10 +11,15 @@ export interface LinkHooks {
|
|
|
11
11
|
export interface LinkSettings {
|
|
12
12
|
readonly open: () => Promise<ChannelModel>;
|
|
13
13
|
readonly reconnect: Required<ReconnectOptions>;
|
|
14
|
+
/** The time the broker has to open the connection, then to answer what the hooks set up on it. */
|
|
15
|
+
readonly connectTimeoutMs: number;
|
|
16
|
+
/** The time a close waits for the answer of the broker. */
|
|
17
|
+
readonly publishTimeoutMs: number;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* The one connection of a bus, kept alive: when it drops, it is opened again after a delay
|
|
17
|
-
* that grows with each failed attempt, and the hooks rebuild what lived on it.
|
|
21
|
+
* that grows with each failed attempt, and the hooks rebuild what lived on it. An attempt the
|
|
22
|
+
* broker stops answering fails in time and is retried: it never holds the link.
|
|
18
23
|
*/
|
|
19
24
|
export declare class BrokerLink {
|
|
20
25
|
private readonly settings;
|
|
@@ -38,6 +43,8 @@ export declare class BrokerLink {
|
|
|
38
43
|
private open;
|
|
39
44
|
private establish;
|
|
40
45
|
private connect;
|
|
46
|
+
/** A broker that stopped answering does not answer a close either: it is not waited for longer. */
|
|
47
|
+
private closeInTime;
|
|
41
48
|
private lost;
|
|
42
49
|
private failed;
|
|
43
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broker-link.d.ts","sourceRoot":"","sources":["../../src/connection/broker-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"broker-link.d.ts","sourceRoot":"","sources":["../../src/connection/broker-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAM5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAMrE,MAAM,WAAW,SAAS;IACxB,yFAAyF;IACzF,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,6DAA6D;IAC7D,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC/C,kGAAkG;IAClG,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,2DAA2D;IAC3D,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAID;;;;GAIG;AACH,qBAAa,UAAU;IAYnB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAZxB,OAAO,CAAC,KAAK,CAA2B;IAExC,OAAO,CAAC,OAAO,CAAoC;IAEnD,OAAO,CAAC,KAAK,CAA4C;IAEzD,OAAO,CAAC,QAAQ,CAAK;IAErB,OAAO,CAAC,MAAM,CAAS;IAEvB,YACmB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,SAAS,EAGlC;IAED;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC,CAkBpC;IAED,2FAA2F;IAC3F,OAAO,IAAI,IAAI,CAOd;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ3B;IAED,MAAM,IAAI,MAAM,CAEf;IAED,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAEzB;IAED,OAAO,CAAC,IAAI;YAmBE,SAAS;YA4BT,OAAO;IASrB,mGAAmG;YACrF,WAAW;IAIzB,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,MAAM;CAgBf"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { inspect } from 'node:util';
|
|
2
2
|
import { BrokerUnavailableError } from '../errors/broker-unavailable-error.js';
|
|
3
3
|
import { EventBusClosedError } from '../errors/event-bus-closed-error.js';
|
|
4
|
+
import { connectionFailureCode } from '../errors/connection-failure-code.js';
|
|
4
5
|
import { failureCode } from '../errors/failure-code.js';
|
|
5
6
|
import { ignore } from '../ignore.js';
|
|
6
7
|
import { conceal } from '../secrecy/conceal.js';
|
|
8
|
+
import { answeredWithin } from './answered-within.js';
|
|
9
|
+
import { openedWithin } from './opened-within.js';
|
|
10
|
+
import { within } from './within.js';
|
|
7
11
|
const DESCRIPTION = 'BrokerLink [connection concealed]';
|
|
8
12
|
/**
|
|
9
13
|
* The one connection of a bus, kept alive: when it drops, it is opened again after a delay
|
|
10
|
-
* that grows with each failed attempt, and the hooks rebuild what lived on it.
|
|
14
|
+
* that grows with each failed attempt, and the hooks rebuild what lived on it. An attempt the
|
|
15
|
+
* broker stops answering fails in time and is retried: it never holds the link.
|
|
11
16
|
*/
|
|
12
17
|
export class BrokerLink {
|
|
13
18
|
settings;
|
|
@@ -55,7 +60,7 @@ export class BrokerLink {
|
|
|
55
60
|
this.retry = undefined;
|
|
56
61
|
const model = this.model ?? (await this.opening?.catch(ignore));
|
|
57
62
|
this.model = undefined;
|
|
58
|
-
await
|
|
63
|
+
await this.closeInTime(model);
|
|
59
64
|
}
|
|
60
65
|
toJSON() {
|
|
61
66
|
return DESCRIPTION;
|
|
@@ -70,28 +75,29 @@ export class BrokerLink {
|
|
|
70
75
|
.then(() => {
|
|
71
76
|
this.failures = 0;
|
|
72
77
|
}, (error) => {
|
|
73
|
-
this.failed(
|
|
78
|
+
this.failed(connectionFailureCode(error));
|
|
74
79
|
})
|
|
75
80
|
.finally(() => {
|
|
76
81
|
this.opening = undefined;
|
|
77
82
|
});
|
|
78
83
|
}
|
|
79
84
|
async establish() {
|
|
80
|
-
const
|
|
85
|
+
const { connectTimeoutMs } = this.settings;
|
|
86
|
+
const model = await openedWithin(connectTimeoutMs, this.connect());
|
|
81
87
|
model.on('error', ignore);
|
|
82
88
|
model.on('close', () => {
|
|
83
89
|
this.lost(model);
|
|
84
90
|
});
|
|
85
91
|
try {
|
|
86
|
-
await this.hooks.opened(model);
|
|
92
|
+
await answeredWithin(connectTimeoutMs, this.hooks.opened(model));
|
|
87
93
|
}
|
|
88
94
|
catch (error) {
|
|
89
95
|
this.hooks.lost();
|
|
90
|
-
await
|
|
91
|
-
throw
|
|
96
|
+
await this.closeInTime(model);
|
|
97
|
+
throw unavailable(error);
|
|
92
98
|
}
|
|
93
99
|
if (this.closed) {
|
|
94
|
-
await
|
|
100
|
+
await this.closeInTime(model);
|
|
95
101
|
throw new EventBusClosedError();
|
|
96
102
|
}
|
|
97
103
|
this.model = model;
|
|
@@ -106,6 +112,10 @@ export class BrokerLink {
|
|
|
106
112
|
throw new BrokerUnavailableError(failureCode(error));
|
|
107
113
|
}
|
|
108
114
|
}
|
|
115
|
+
/** A broker that stopped answering does not answer a close either: it is not waited for longer. */
|
|
116
|
+
async closeInTime(model) {
|
|
117
|
+
await within(this.settings.publishTimeoutMs, model?.close().catch(ignore));
|
|
118
|
+
}
|
|
109
119
|
lost(model) {
|
|
110
120
|
if (this.model !== model) {
|
|
111
121
|
return;
|
|
@@ -130,4 +140,8 @@ export class BrokerLink {
|
|
|
130
140
|
}, delay);
|
|
131
141
|
}
|
|
132
142
|
}
|
|
143
|
+
// A request the broker did not answer in time keeps its reason; any other failure gives its code.
|
|
144
|
+
function unavailable(error) {
|
|
145
|
+
return error instanceof BrokerUnavailableError ? error : new BrokerUnavailableError(failureCode(error));
|
|
146
|
+
}
|
|
133
147
|
//# sourceMappingURL=broker-link.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broker-link.js","sourceRoot":"","sources":["../../src/connection/broker-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"broker-link.js","sourceRoot":"","sources":["../../src/connection/broker-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,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K,KAAK,KAAK,EAAE,CAAC;YACzB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAElB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,IAAY;QACzB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxB,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEnE,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;QAEnB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC3B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;YACvB,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC,EAAE,KAAK,CAAC,CAAC;IACZ,CAAC;CACF;AAED,kGAAkG;AAClG,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,KAAK,YAAY,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,sBAAsB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1G,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Closable } from './opened-within.js';
|
|
2
|
+
/**
|
|
3
|
+
* One bound for a whole call, however many requests it makes: each request has the time that
|
|
4
|
+
* the requests before it left.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Deadline {
|
|
7
|
+
private readonly endsAt;
|
|
8
|
+
constructor(ms: number);
|
|
9
|
+
get leftMs(): number;
|
|
10
|
+
answered<T>(request: Promise<T>): Promise<T>;
|
|
11
|
+
opened<T extends Closable>(opening: Promise<T>): Promise<T>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=deadline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadline.d.ts","sourceRoot":"","sources":["../../src/connection/deadline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,iBAAiB,CAAC;AAE9D;;;GAGG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,YAAY,EAAE,EAAE,MAAM,EAErB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE3C;IAED,MAAM,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE1D;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { answeredWithin } from './answered-within.js';
|
|
2
|
+
import { openedWithin } from './opened-within.js';
|
|
3
|
+
/**
|
|
4
|
+
* One bound for a whole call, however many requests it makes: each request has the time that
|
|
5
|
+
* the requests before it left.
|
|
6
|
+
*/
|
|
7
|
+
export class Deadline {
|
|
8
|
+
endsAt;
|
|
9
|
+
constructor(ms) {
|
|
10
|
+
this.endsAt = performance.now() + ms;
|
|
11
|
+
}
|
|
12
|
+
get leftMs() {
|
|
13
|
+
return Math.max(0, this.endsAt - performance.now());
|
|
14
|
+
}
|
|
15
|
+
answered(request) {
|
|
16
|
+
return answeredWithin(this.leftMs, request);
|
|
17
|
+
}
|
|
18
|
+
opened(opening) {
|
|
19
|
+
return openedWithin(this.leftMs, opening);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=deadline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadline.js","sourceRoot":"","sources":["../../src/connection/deadline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAiB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACF,MAAM,CAAS;IAEhC,YAAY,EAAU;QACpB,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;IACvC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ,CAAI,OAAmB;QAC7B,OAAO,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAqB,OAAmB;QAC5C,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface Closable {
|
|
2
|
+
close(): Promise<void>;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* A connection or a channel the broker opened within `ms`, or `BrokerUnavailableError`
|
|
6
|
+
* (`REQUEST_TIMEOUT`). One that opens later is closed when it arrives: nobody would use it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function openedWithin<T extends Closable>(ms: number, opening: Promise<T>): Promise<T>;
|
|
9
|
+
//# sourceMappingURL=opened-within.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opened-within.d.ts","sourceRoot":"","sources":["../../src/connection/opened-within.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE5F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { answeredWithin } from './answered-within.js';
|
|
2
|
+
/**
|
|
3
|
+
* A connection or a channel the broker opened within `ms`, or `BrokerUnavailableError`
|
|
4
|
+
* (`REQUEST_TIMEOUT`). One that opens later is closed when it arrives: nobody would use it.
|
|
5
|
+
*/
|
|
6
|
+
export function openedWithin(ms, opening) {
|
|
7
|
+
return answeredWithin(ms, opening, (late) => late.close());
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=opened-within.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opened-within.js","sourceRoot":"","sources":["../../src/connection/opened-within.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAqB,EAAU,EAAE,OAAmB;IAC9E,OAAO,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Waits for `work`, or for `ms`, whichever ends first: a broker that
|
|
3
|
-
* or a connection cut that the client has not noticed yet) never holds
|
|
2
|
+
* Waits for `work`, or for `ms`, whichever ends first, and tells whether `work` did: a broker that
|
|
3
|
+
* stopped answering (stalled, or a connection cut that the client has not noticed yet) never holds
|
|
4
|
+
* a close forever.
|
|
4
5
|
*/
|
|
5
|
-
export declare function within(ms: number, work: Promise<unknown> | undefined): Promise<
|
|
6
|
+
export declare function within(ms: number, work: Promise<unknown> | undefined): Promise<boolean>;
|
|
6
7
|
//# sourceMappingURL=within.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"within.d.ts","sourceRoot":"","sources":["../../src/connection/within.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"within.d.ts","sourceRoot":"","sources":["../../src/connection/within.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAS7F"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Waits for `work`, or for `ms`, whichever ends first: a broker that
|
|
3
|
-
* or a connection cut that the client has not noticed yet) never holds
|
|
2
|
+
* Waits for `work`, or for `ms`, whichever ends first, and tells whether `work` did: a broker that
|
|
3
|
+
* stopped answering (stalled, or a connection cut that the client has not noticed yet) never holds
|
|
4
|
+
* a close forever.
|
|
4
5
|
*/
|
|
5
6
|
export async function within(ms, work) {
|
|
6
7
|
let timer;
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
const late = new Promise((resolve) => (timer = setTimeout(resolve, ms, false)));
|
|
9
|
+
try {
|
|
10
|
+
return await Promise.race([work?.then(() => true) ?? true, late]);
|
|
11
|
+
}
|
|
12
|
+
finally {
|
|
13
|
+
clearTimeout(timer);
|
|
14
|
+
}
|
|
9
15
|
}
|
|
10
16
|
//# sourceMappingURL=within.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"within.js","sourceRoot":"","sources":["../../src/connection/within.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"within.js","sourceRoot":"","sources":["../../src/connection/within.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,EAAU,EAAE,IAAkC;IACzE,IAAI,KAAgD,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,OAAO,CAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAEvF,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -11,21 +11,28 @@ export interface ConsumptionSettings {
|
|
|
11
11
|
readonly retry: Required<RetryOptions>;
|
|
12
12
|
readonly onFailure: (failure: RabbitMqFailure) => void;
|
|
13
13
|
readonly onDelivery: (delivery: RabbitMqDelivery) => void;
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* How long the copy of a message to its retry or dead queue waits for its confirmation, and a
|
|
16
|
+
* close for each answer of the broker: one that stopped answering holds neither.
|
|
17
|
+
*/
|
|
15
18
|
readonly publishTimeoutMs: number;
|
|
19
|
+
/** How long the start of a subscription waits for its declarations. */
|
|
20
|
+
readonly connectTimeoutMs: number;
|
|
16
21
|
/** Called when the channel dies while the connection lives. */
|
|
17
22
|
readonly channelLost: () => void;
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
20
25
|
* The consuming side: one durable queue per consumer and event type, manual acknowledgement
|
|
21
26
|
* once every handler resolved, and for a failure a wait in the retry queue, then the dead
|
|
22
|
-
* queue when the attempts are spent. A message
|
|
27
|
+
* queue when the attempts are spent. A message whose handlers all left waits there too, for
|
|
28
|
+
* the next one, counted as no attempt. A message is never requeued at once: no hot loop.
|
|
23
29
|
*/
|
|
24
30
|
export declare class Consumption {
|
|
25
31
|
private readonly settings;
|
|
26
32
|
private readonly subscriptions;
|
|
27
33
|
private readonly starting;
|
|
28
34
|
private readonly handling;
|
|
35
|
+
private readonly confirmations;
|
|
29
36
|
private channel;
|
|
30
37
|
constructor(settings: ConsumptionSettings);
|
|
31
38
|
get inFlight(): number;
|
|
@@ -41,10 +48,18 @@ export declare class Consumption {
|
|
|
41
48
|
private startOrGiveUp;
|
|
42
49
|
private start;
|
|
43
50
|
private process;
|
|
51
|
+
/**
|
|
52
|
+
* Every handler left while the message was on its way: it waits for the next one in the retry
|
|
53
|
+
* queue, with the attempt number it came with. Finding nobody is no attempt.
|
|
54
|
+
*/
|
|
55
|
+
private leave;
|
|
44
56
|
private deliveryOf;
|
|
45
57
|
private buryPoison;
|
|
46
58
|
private retryOrBury;
|
|
47
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Confirmed copy to the other queue first, acknowledgement second: never lost in between. A
|
|
61
|
+
* copy the broker refused, or did not confirm in time, hands the message back to its queue.
|
|
62
|
+
*/
|
|
48
63
|
private move;
|
|
49
64
|
private settled;
|
|
50
65
|
private remove;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumption.d.ts","sourceRoot":"","sources":["../../src/consumption/consumption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAkC,MAAM,SAAS,CAAC;AAC5E,OAAO,KAAK,EAAmC,wBAAwB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"consumption.d.ts","sourceRoot":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,CAAgB;IAE9C,OAAO,CAAC,OAAO,CAA6B;IAE5C,YAA6B,QAAQ,EAAE,mBAAmB,EAEzD;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,QAAQ,IAAI,eAAe,EAAE,CAE5B;IAED,GAAG,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,wBAAwB,GAAG,YAAY,CAU7E;IAEK,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB/C;IAED,MAAM,IAAI,IAAI,CAOb;IAED,oFAAoF;IAC9E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAI7B;IAED,mFAAmF;IAC7E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAa3B;IAED,OAAO,CAAC,cAAc;YAmBR,aAAa;YAUb,KAAK;YAqBL,OAAO;IA+BrB;;;OAGG;YACW,KAAK;IAMnB,OAAO,CAAC,UAAU;YAUJ,UAAU;YAYV,WAAW;IAkBzB;;;OAGG;YACW,IAAI;IAoBlB,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,MAAM;CAef"}
|
|
@@ -2,30 +2,34 @@ import { attemptOf } from '../codec/attempt-of.js';
|
|
|
2
2
|
import { decode } from '../codec/decode.js';
|
|
3
3
|
import { ATTEMPT_HEADER, DEAD_REASON_HEADER, ERROR_CODE_HEADER } from '../codec/headers.js';
|
|
4
4
|
import { republication } from '../codec/republication.js';
|
|
5
|
-
import {
|
|
5
|
+
import { connectionFailureCode } from '../errors/connection-failure-code.js';
|
|
6
6
|
import { ignore } from '../ignore.js';
|
|
7
7
|
import { MESSAGING_SYSTEM } from '../messaging-system.js';
|
|
8
|
-
import {
|
|
8
|
+
import { Confirmations } from '../publication/confirmations.js';
|
|
9
9
|
import { declareTopology } from '../topology/declare-topology.js';
|
|
10
10
|
import { queueNamesOf } from '../topology/queue-names-of.js';
|
|
11
11
|
import { topologyOf } from '../topology/topology-of.js';
|
|
12
12
|
import { failureOf } from './failure-of.js';
|
|
13
13
|
import { POISON_MESSAGE } from './poison-message.js';
|
|
14
14
|
import { track } from './track.js';
|
|
15
|
+
import { answeredWithin } from '../connection/answered-within.js';
|
|
15
16
|
import { within } from '../connection/within.js';
|
|
16
17
|
/**
|
|
17
18
|
* The consuming side: one durable queue per consumer and event type, manual acknowledgement
|
|
18
19
|
* once every handler resolved, and for a failure a wait in the retry queue, then the dead
|
|
19
|
-
* queue when the attempts are spent. A message
|
|
20
|
+
* queue when the attempts are spent. A message whose handlers all left waits there too, for
|
|
21
|
+
* the next one, counted as no attempt. A message is never requeued at once: no hot loop.
|
|
20
22
|
*/
|
|
21
23
|
export class Consumption {
|
|
22
24
|
settings;
|
|
23
25
|
subscriptions = new Map();
|
|
24
26
|
starting = new Set();
|
|
25
27
|
handling = new Set();
|
|
28
|
+
confirmations;
|
|
26
29
|
channel;
|
|
27
30
|
constructor(settings) {
|
|
28
31
|
this.settings = settings;
|
|
32
|
+
this.confirmations = new Confirmations(settings.publishTimeoutMs);
|
|
29
33
|
}
|
|
30
34
|
get inFlight() {
|
|
31
35
|
return this.handling.size;
|
|
@@ -59,6 +63,7 @@ export class Consumption {
|
|
|
59
63
|
}
|
|
60
64
|
detach() {
|
|
61
65
|
this.channel = undefined;
|
|
66
|
+
this.confirmations.abandon();
|
|
62
67
|
for (const subscription of this.subscriptions.values()) {
|
|
63
68
|
subscription.consumerTag = undefined;
|
|
64
69
|
}
|
|
@@ -95,10 +100,11 @@ export class Consumption {
|
|
|
95
100
|
}
|
|
96
101
|
async startOrGiveUp(channel, subscription) {
|
|
97
102
|
try {
|
|
98
|
-
|
|
103
|
+
// A broker that stops answering a declaration loses the channel too: the link rebuilds it.
|
|
104
|
+
await answeredWithin(this.settings.connectTimeoutMs, this.start(channel, subscription));
|
|
99
105
|
}
|
|
100
106
|
catch (error) {
|
|
101
|
-
this.settings.onFailure({ kind: 'connection', code:
|
|
107
|
+
this.settings.onFailure({ kind: 'connection', code: connectionFailureCode(error) });
|
|
102
108
|
this.settings.channelLost();
|
|
103
109
|
}
|
|
104
110
|
}
|
|
@@ -115,7 +121,7 @@ export class Consumption {
|
|
|
115
121
|
});
|
|
116
122
|
subscription.consumerTag = consumerTag;
|
|
117
123
|
// The subscription left while its consumer was being registered: the consumer leaves too,
|
|
118
|
-
// or every message of the queue would reach a consumer without handler and
|
|
124
|
+
// or every message of the queue would reach a consumer without handler and wait a retry delay.
|
|
119
125
|
if (this.subscriptions.get(subscription.queues.work) !== subscription) {
|
|
120
126
|
void channel.cancel(consumerTag).catch(ignore);
|
|
121
127
|
}
|
|
@@ -128,9 +134,7 @@ export class Consumption {
|
|
|
128
134
|
return;
|
|
129
135
|
}
|
|
130
136
|
if (subscription.handlers.size === 0) {
|
|
131
|
-
|
|
132
|
-
channel.nack(message, false, true);
|
|
133
|
-
});
|
|
137
|
+
await this.leave(delivery);
|
|
134
138
|
return;
|
|
135
139
|
}
|
|
136
140
|
const code = await failureOf(subscription.handlers, event, this.deliveryOf(delivery));
|
|
@@ -143,6 +147,14 @@ export class Consumption {
|
|
|
143
147
|
}
|
|
144
148
|
await this.retryOrBury(delivery, event, code);
|
|
145
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Every handler left while the message was on its way: it waits for the next one in the retry
|
|
152
|
+
* queue, with the attempt number it came with. Finding nobody is no attempt.
|
|
153
|
+
*/
|
|
154
|
+
async leave(delivery) {
|
|
155
|
+
const { retry } = delivery.subscription.queues;
|
|
156
|
+
await this.move(delivery, retry, { [ATTEMPT_HEADER]: attemptOf(delivery.message) });
|
|
157
|
+
}
|
|
146
158
|
deliveryOf({ subscription, message }) {
|
|
147
159
|
return {
|
|
148
160
|
attempt: attemptOf(message),
|
|
@@ -176,10 +188,13 @@ export class Consumption {
|
|
|
176
188
|
await this.move(delivery, retry, { [ERROR_CODE_HEADER]: code, [ATTEMPT_HEADER]: attempt + 1 });
|
|
177
189
|
}
|
|
178
190
|
}
|
|
179
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Confirmed copy to the other queue first, acknowledgement second: never lost in between. A
|
|
193
|
+
* copy the broker refused, or did not confirm in time, hands the message back to its queue.
|
|
194
|
+
*/
|
|
180
195
|
async move({ channel, message }, queue, headers) {
|
|
181
196
|
try {
|
|
182
|
-
await
|
|
197
|
+
await this.confirmations.ofCopy(channel, queue, republication(message, headers));
|
|
183
198
|
}
|
|
184
199
|
catch {
|
|
185
200
|
quietly(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumption.js","sourceRoot":"","sources":["../../src/consumption/consumption.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"consumption.js","sourceRoot":"","sources":["../../src/consumption/consumption.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAA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