@ddd-ts-kit/rabbitmq 0.0.0-stage → 0.1.1

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.
Files changed (174) hide show
  1. package/README.md +277 -2
  2. package/dist/codec/attempt-of.d.ts +4 -0
  3. package/dist/codec/attempt-of.d.ts.map +1 -0
  4. package/dist/codec/attempt-of.js +8 -0
  5. package/dist/codec/attempt-of.js.map +1 -0
  6. package/dist/codec/decode.d.ts +5 -0
  7. package/dist/codec/decode.d.ts.map +1 -0
  8. package/dist/codec/decode.js +39 -0
  9. package/dist/codec/decode.js.map +1 -0
  10. package/dist/codec/encode.d.ts +8 -0
  11. package/dist/codec/encode.d.ts.map +1 -0
  12. package/dist/codec/encode.js +23 -0
  13. package/dist/codec/encode.js.map +1 -0
  14. package/dist/codec/headers-of.d.ts +4 -0
  15. package/dist/codec/headers-of.d.ts.map +1 -0
  16. package/dist/codec/headers-of.js +6 -0
  17. package/dist/codec/headers-of.js.map +1 -0
  18. package/dist/codec/headers.d.ts +7 -0
  19. package/dist/codec/headers.d.ts.map +1 -0
  20. package/dist/codec/headers.js +7 -0
  21. package/dist/codec/headers.js.map +1 -0
  22. package/dist/codec/publication.d.ts +7 -0
  23. package/dist/codec/publication.d.ts.map +1 -0
  24. package/dist/codec/publication.js +2 -0
  25. package/dist/codec/publication.js.map +1 -0
  26. package/dist/codec/republication.d.ts +5 -0
  27. package/dist/codec/republication.d.ts.map +1 -0
  28. package/dist/codec/republication.js +20 -0
  29. package/dist/codec/republication.js.map +1 -0
  30. package/dist/connection/broker-link.d.ts +44 -0
  31. package/dist/connection/broker-link.d.ts.map +1 -0
  32. package/dist/connection/broker-link.js +133 -0
  33. package/dist/connection/broker-link.js.map +1 -0
  34. package/dist/consumption/consumption.d.ts +50 -0
  35. package/dist/consumption/consumption.d.ts.map +1 -0
  36. package/dist/consumption/consumption.js +214 -0
  37. package/dist/consumption/consumption.js.map +1 -0
  38. package/dist/consumption/failure-of.d.ts +7 -0
  39. package/dist/consumption/failure-of.d.ts.map +1 -0
  40. package/dist/consumption/failure-of.js +18 -0
  41. package/dist/consumption/failure-of.js.map +1 -0
  42. package/dist/consumption/poison-message.d.ts +3 -0
  43. package/dist/consumption/poison-message.d.ts.map +1 -0
  44. package/dist/consumption/poison-message.js +3 -0
  45. package/dist/consumption/poison-message.js.map +1 -0
  46. package/dist/consumption/track.d.ts +3 -0
  47. package/dist/consumption/track.d.ts.map +1 -0
  48. package/dist/consumption/track.js +9 -0
  49. package/dist/consumption/track.js.map +1 -0
  50. package/dist/errors/broker-unavailable-error.d.ts +8 -0
  51. package/dist/errors/broker-unavailable-error.d.ts.map +1 -0
  52. package/dist/errors/broker-unavailable-error.js +12 -0
  53. package/dist/errors/broker-unavailable-error.js.map +1 -0
  54. package/dist/errors/consumer-name-required-error.d.ts +5 -0
  55. package/dist/errors/consumer-name-required-error.d.ts.map +1 -0
  56. package/dist/errors/consumer-name-required-error.js +8 -0
  57. package/dist/errors/consumer-name-required-error.js.map +1 -0
  58. package/dist/errors/event-bus-closed-error.d.ts +5 -0
  59. package/dist/errors/event-bus-closed-error.d.ts.map +1 -0
  60. package/dist/errors/event-bus-closed-error.js +8 -0
  61. package/dist/errors/event-bus-closed-error.js.map +1 -0
  62. package/dist/errors/failure-code.d.ts +6 -0
  63. package/dist/errors/failure-code.d.ts.map +1 -0
  64. package/dist/errors/failure-code.js +15 -0
  65. package/dist/errors/failure-code.js.map +1 -0
  66. package/dist/errors/publish-not-confirmed-error.d.ts +7 -0
  67. package/dist/errors/publish-not-confirmed-error.d.ts.map +1 -0
  68. package/dist/errors/publish-not-confirmed-error.js +11 -0
  69. package/dist/errors/publish-not-confirmed-error.js.map +1 -0
  70. package/dist/errors/unroutable-event-error.d.ts +8 -0
  71. package/dist/errors/unroutable-event-error.d.ts.map +1 -0
  72. package/dist/errors/unroutable-event-error.js +13 -0
  73. package/dist/errors/unroutable-event-error.js.map +1 -0
  74. package/dist/ignore.d.ts +3 -0
  75. package/dist/ignore.d.ts.map +1 -0
  76. package/dist/ignore.js +5 -0
  77. package/dist/ignore.js.map +1 -0
  78. package/dist/index.d.ts +23 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +11 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/messaging-system.d.ts +3 -0
  83. package/dist/messaging-system.d.ts.map +1 -0
  84. package/dist/messaging-system.js +3 -0
  85. package/dist/messaging-system.js.map +1 -0
  86. package/dist/options/queue-type.d.ts +2 -0
  87. package/dist/options/queue-type.d.ts.map +1 -0
  88. package/dist/options/queue-type.js +2 -0
  89. package/dist/options/queue-type.js.map +1 -0
  90. package/dist/options/rabbit-mq-delivery.d.ts +12 -0
  91. package/dist/options/rabbit-mq-delivery.d.ts.map +1 -0
  92. package/dist/options/rabbit-mq-delivery.js +2 -0
  93. package/dist/options/rabbit-mq-delivery.js.map +1 -0
  94. package/dist/options/rabbit-mq-event-bus-options.d.ts +31 -0
  95. package/dist/options/rabbit-mq-event-bus-options.d.ts.map +1 -0
  96. package/dist/options/rabbit-mq-event-bus-options.js +2 -0
  97. package/dist/options/rabbit-mq-event-bus-options.js.map +1 -0
  98. package/dist/options/rabbit-mq-failure.d.ts +17 -0
  99. package/dist/options/rabbit-mq-failure.d.ts.map +1 -0
  100. package/dist/options/rabbit-mq-failure.js +2 -0
  101. package/dist/options/rabbit-mq-failure.js.map +1 -0
  102. package/dist/options/reconnect-options.d.ts +9 -0
  103. package/dist/options/reconnect-options.d.ts.map +1 -0
  104. package/dist/options/reconnect-options.js +2 -0
  105. package/dist/options/reconnect-options.js.map +1 -0
  106. package/dist/options/retry-options.d.ts +7 -0
  107. package/dist/options/retry-options.d.ts.map +1 -0
  108. package/dist/options/retry-options.js +2 -0
  109. package/dist/options/retry-options.js.map +1 -0
  110. package/dist/options/settings-of.d.ts +5 -0
  111. package/dist/options/settings-of.d.ts.map +1 -0
  112. package/dist/options/settings-of.js +38 -0
  113. package/dist/options/settings-of.js.map +1 -0
  114. package/dist/options/settings.d.ts +20 -0
  115. package/dist/options/settings.d.ts.map +1 -0
  116. package/dist/options/settings.js +2 -0
  117. package/dist/options/settings.js.map +1 -0
  118. package/dist/publication/publications.d.ts +28 -0
  119. package/dist/publication/publications.d.ts.map +1 -0
  120. package/dist/publication/publications.js +87 -0
  121. package/dist/publication/publications.js.map +1 -0
  122. package/dist/publication/send-confirmed.d.ts +5 -0
  123. package/dist/publication/send-confirmed.d.ts.map +1 -0
  124. package/dist/publication/send-confirmed.js +21 -0
  125. package/dist/publication/send-confirmed.js.map +1 -0
  126. package/dist/rabbit-mq-event-bus.d.ts +55 -0
  127. package/dist/rabbit-mq-event-bus.d.ts.map +1 -0
  128. package/dist/rabbit-mq-event-bus.js +168 -0
  129. package/dist/rabbit-mq-event-bus.js.map +1 -0
  130. package/dist/secrecy/conceal.d.ts +8 -0
  131. package/dist/secrecy/conceal.d.ts.map +1 -0
  132. package/dist/secrecy/conceal.js +12 -0
  133. package/dist/secrecy/conceal.js.map +1 -0
  134. package/dist/topology/binding-description.d.ts +6 -0
  135. package/dist/topology/binding-description.d.ts.map +1 -0
  136. package/dist/topology/binding-description.js +2 -0
  137. package/dist/topology/binding-description.js.map +1 -0
  138. package/dist/topology/consumer-binding.d.ts +6 -0
  139. package/dist/topology/consumer-binding.d.ts.map +1 -0
  140. package/dist/topology/consumer-binding.js +2 -0
  141. package/dist/topology/consumer-binding.js.map +1 -0
  142. package/dist/topology/declare-topology.d.ts +5 -0
  143. package/dist/topology/declare-topology.d.ts.map +1 -0
  144. package/dist/topology/declare-topology.js +13 -0
  145. package/dist/topology/declare-topology.js.map +1 -0
  146. package/dist/topology/exchange-description.d.ts +6 -0
  147. package/dist/topology/exchange-description.d.ts.map +1 -0
  148. package/dist/topology/exchange-description.js +2 -0
  149. package/dist/topology/exchange-description.js.map +1 -0
  150. package/dist/topology/queue-description.d.ts +8 -0
  151. package/dist/topology/queue-description.d.ts.map +1 -0
  152. package/dist/topology/queue-description.js +2 -0
  153. package/dist/topology/queue-description.js.map +1 -0
  154. package/dist/topology/queue-names-of.d.ts +4 -0
  155. package/dist/topology/queue-names-of.d.ts.map +1 -0
  156. package/dist/topology/queue-names-of.js +5 -0
  157. package/dist/topology/queue-names-of.js.map +1 -0
  158. package/dist/topology/queue-names.d.ts +6 -0
  159. package/dist/topology/queue-names.d.ts.map +1 -0
  160. package/dist/topology/queue-names.js +2 -0
  161. package/dist/topology/queue-names.js.map +1 -0
  162. package/dist/topology/rabbit-mq-topology.d.ts +10 -0
  163. package/dist/topology/rabbit-mq-topology.d.ts.map +1 -0
  164. package/dist/topology/rabbit-mq-topology.js +2 -0
  165. package/dist/topology/rabbit-mq-topology.js.map +1 -0
  166. package/dist/topology/topology-of.d.ts +5 -0
  167. package/dist/topology/topology-of.d.ts.map +1 -0
  168. package/dist/topology/topology-of.js +50 -0
  169. package/dist/topology/topology-of.js.map +1 -0
  170. package/dist/topology/topology-settings.d.ts +7 -0
  171. package/dist/topology/topology-settings.d.ts.map +1 -0
  172. package/dist/topology/topology-settings.js +2 -0
  173. package/dist/topology/topology-settings.js.map +1 -0
  174. package/package.json +37 -4
@@ -0,0 +1,168 @@
1
+ import { inspect } from 'node:util';
2
+ import { connect } from 'amqplib';
3
+ import { ATTEMPT_HEADER } from './codec/headers.js';
4
+ import { republication } from './codec/republication.js';
5
+ import { BrokerLink } from './connection/broker-link.js';
6
+ import { Consumption } from './consumption/consumption.js';
7
+ import { ConsumerNameRequiredError } from './errors/consumer-name-required-error.js';
8
+ import { MESSAGING_SYSTEM } from './messaging-system.js';
9
+ import { EventBusClosedError } from './errors/event-bus-closed-error.js';
10
+ import { settingsOf } from './options/settings-of.js';
11
+ import { Publications } from './publication/publications.js';
12
+ import { conceal } from './secrecy/conceal.js';
13
+ import { sendConfirmed } from './publication/send-confirmed.js';
14
+ import { declareTopology } from './topology/declare-topology.js';
15
+ import { queueNamesOf } from './topology/queue-names-of.js';
16
+ import { topologyOf } from './topology/topology-of.js';
17
+ const DESCRIPTION = 'RabbitMqEventBus [connection concealed]';
18
+ /**
19
+ * The provider for RabbitMQ and other AMQP 0-9-1 brokers.
20
+ *
21
+ * Publishing: a durable topic exchange, routing key = event type, persistent messages, and
22
+ * `publish` resolves only when the broker confirmed every message, so it is a safe target for
23
+ * the outbox relay. Consuming: a durable queue per consumer and event type, acknowledged
24
+ * after the handlers resolved, a bounded number of delayed retries, then a dead queue.
25
+ * Delivery is at least once and unordered: consumers deduplicate.
26
+ */
27
+ export class RabbitMqEventBus {
28
+ /** Read by what observes the bus from outside: the name of the transport. */
29
+ messagingSystem = MESSAGING_SYSTEM;
30
+ settings;
31
+ link;
32
+ publications;
33
+ consumption;
34
+ closed = false;
35
+ constructor(options) {
36
+ this.settings = settingsOf(options, connect);
37
+ const channelLost = () => {
38
+ this.link.restart();
39
+ };
40
+ this.publications = new Publications({ ...this.settings, channelLost });
41
+ this.consumption = new Consumption({
42
+ ...this.settings,
43
+ topology: topologySettingsOf(this.settings),
44
+ channelLost,
45
+ });
46
+ this.link = new BrokerLink(this.settings, {
47
+ opened: async (model) => {
48
+ await this.publications.attach(model);
49
+ await this.consumption.attach(model);
50
+ },
51
+ lost: () => {
52
+ this.publications.detach();
53
+ this.consumption.detach();
54
+ },
55
+ failed: (code) => {
56
+ this.settings.onFailure({ kind: 'connection', code });
57
+ },
58
+ });
59
+ conceal(this);
60
+ }
61
+ /** Messages delivered to this bus whose handlers have not finished yet. */
62
+ get deliveriesInFlight() {
63
+ return this.consumption.inFlight;
64
+ }
65
+ /**
66
+ * Resolves when the broker confirmed every event, rejects otherwise: nothing is buffered
67
+ * for later, so the caller (the outbox relay) knows what to retry.
68
+ */
69
+ async publish(events) {
70
+ if (events.length === 0) {
71
+ return;
72
+ }
73
+ await this.link.opened();
74
+ // The queues of this bus are bound before it publishes: it never misses its own events.
75
+ await this.consumption.started();
76
+ await this.publications.publish(events);
77
+ }
78
+ /** Subscribes the consumer named by the `consumer` option. */
79
+ subscribe(type, handler) {
80
+ if (this.settings.consumer === undefined) {
81
+ throw new ConsumerNameRequiredError();
82
+ }
83
+ return this.consume({ consumer: this.settings.consumer, type }, handler);
84
+ }
85
+ /** A subscriber for one consuming context, on the connection of this bus. */
86
+ forConsumer(consumer) {
87
+ if (consumer.length === 0) {
88
+ throw new ConsumerNameRequiredError();
89
+ }
90
+ return { subscribe: (type, handler) => this.consume({ consumer, type }, handler) };
91
+ }
92
+ /**
93
+ * Connects if needed and declares the exchange, the queues and the bindings of the
94
+ * subscriptions made so far. Idempotent. Resolves once those subscriptions are consuming.
95
+ */
96
+ async assertTopology() {
97
+ const model = await this.link.opened();
98
+ // On a channel of its own: a refused declaration closes the channel it was made on.
99
+ const channel = await model.createChannel();
100
+ channel.on('error', () => undefined);
101
+ await declareTopology(channel, this.describeTopology());
102
+ await channel.close();
103
+ await this.consumption.started();
104
+ }
105
+ describeTopology() {
106
+ return topologyOf(topologySettingsOf(this.settings), this.consumption.bindings());
107
+ }
108
+ /**
109
+ * Moves up to `limit` messages from the dead queue of a consumer back to its work queue,
110
+ * with a fresh attempt budget. Returns how many were moved.
111
+ */
112
+ async replayDead(binding, limit = 100) {
113
+ const { work, dead } = queueNamesOf(binding);
114
+ const channel = await (await this.link.opened()).createConfirmChannel();
115
+ channel.on('error', () => undefined);
116
+ let replayed = 0;
117
+ try {
118
+ for (; replayed < limit; replayed += 1) {
119
+ const message = await channel.get(dead, { noAck: false });
120
+ if (message === false) {
121
+ break;
122
+ }
123
+ await sendConfirmed(channel, work, republication(message, { [ATTEMPT_HEADER]: 1 }));
124
+ channel.ack(message);
125
+ }
126
+ }
127
+ finally {
128
+ await channel.close().catch(() => undefined);
129
+ }
130
+ return replayed;
131
+ }
132
+ /** Stops consuming, waits for the handlers and the confirmations in flight, disconnects. */
133
+ async close() {
134
+ if (this.closed) {
135
+ return;
136
+ }
137
+ this.closed = true;
138
+ await this.consumption.drain();
139
+ await this.publications.close();
140
+ await this.link.close();
141
+ }
142
+ /** What a serialisation shows of the bus: its name, never its connection. */
143
+ toJSON() {
144
+ return DESCRIPTION;
145
+ }
146
+ /** What `console.log` and `util.inspect` show of the bus: the same. */
147
+ [inspect.custom]() {
148
+ return DESCRIPTION;
149
+ }
150
+ /** Adds a handler to the queue of one consumer for one type, and connects if needed. */
151
+ consume(binding, handler) {
152
+ if (this.closed) {
153
+ throw new EventBusClosedError();
154
+ }
155
+ const subscription = this.consumption.add(binding, handler);
156
+ // Connects in the background; a failure is reported by the link and retried.
157
+ void this.link.opened().catch(() => undefined);
158
+ return subscription;
159
+ }
160
+ }
161
+ function topologySettingsOf(settings) {
162
+ return {
163
+ exchange: settings.exchange,
164
+ queueType: settings.queueType,
165
+ retryDelayMs: settings.retry.delayMs,
166
+ };
167
+ }
168
+ //# sourceMappingURL=rabbit-mq-event-bus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rabbit-mq-event-bus.js","sourceRoot":"","sources":["../src/rabbit-mq-event-bus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAQlC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,a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MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAE/C,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AAED,SAAS,kBAAkB,CAAC,QAAkB;IAC5C,OAAO;QACL,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO;KACrC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Takes the fields an instance holds so far out of enumeration: `Object.keys`, a spread and a
3
+ * comparison no longer reach the client or the connection behind them, whose options carry
4
+ * credentials. Called last in a constructor, next to a `toJSON` and an inspection method that
5
+ * answer a name: nothing the instance is shown through leads to what it holds.
6
+ */
7
+ export declare function conceal(instance: object): void;
8
+ //# sourceMappingURL=conceal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conceal.d.ts","sourceRoot":"","sources":["../../src/secrecy/conceal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAI9C"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Takes the fields an instance holds so far out of enumeration: `Object.keys`, a spread and a
3
+ * comparison no longer reach the client or the connection behind them, whose options carry
4
+ * credentials. Called last in a constructor, next to a `toJSON` and an inspection method that
5
+ * answer a name: nothing the instance is shown through leads to what it holds.
6
+ */
7
+ export function conceal(instance) {
8
+ for (const field of Object.keys(instance)) {
9
+ Object.defineProperty(instance, field, { enumerable: false });
10
+ }
11
+ }
12
+ //# sourceMappingURL=conceal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conceal.js","sourceRoot":"","sources":["../../src/secrecy/conceal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,QAAgB;IACtC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1C,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface BindingDescription {
2
+ readonly exchange: string;
3
+ readonly queue: string;
4
+ readonly routingKey: string;
5
+ }
6
+ //# sourceMappingURL=binding-description.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding-description.d.ts","sourceRoot":"","sources":["../../src/topology/binding-description.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=binding-description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding-description.js","sourceRoot":"","sources":["../../src/topology/binding-description.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /** One consuming context listening to one event type. */
2
+ export interface ConsumerBinding {
3
+ readonly consumer: string;
4
+ readonly type: string;
5
+ }
6
+ //# sourceMappingURL=consumer-binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consumer-binding.d.ts","sourceRoot":"","sources":["../../src/topology/consumer-binding.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=consumer-binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consumer-binding.js","sourceRoot":"","sources":["../../src/topology/consumer-binding.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { Channel } from 'amqplib';
2
+ import type { RabbitMqTopology } from './rabbit-mq-topology.js';
3
+ /** Idempotent: declaring what already exists with the same arguments changes nothing. */
4
+ export declare function declareTopology(channel: Channel, topology: RabbitMqTopology): Promise<void>;
5
+ //# sourceMappingURL=declare-topology.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declare-topology.d.ts","sourceRoot":"","sources":["../../src/topology/declare-topology.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,yFAAyF;AACzF,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYjG"}
@@ -0,0 +1,13 @@
1
+ /** Idempotent: declaring what already exists with the same arguments changes nothing. */
2
+ export async function declareTopology(channel, topology) {
3
+ for (const exchange of topology.exchanges) {
4
+ await channel.assertExchange(exchange.name, exchange.type, { durable: exchange.durable });
5
+ }
6
+ for (const queue of topology.queues) {
7
+ await channel.assertQueue(queue.name, { durable: queue.durable, arguments: queue.arguments });
8
+ }
9
+ for (const binding of topology.bindings) {
10
+ await channel.bindQueue(binding.queue, binding.exchange, binding.routingKey);
11
+ }
12
+ }
13
+ //# sourceMappingURL=declare-topology.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declare-topology.js","sourceRoot":"","sources":["../../src/topology/declare-topology.ts"],"names":[],"mappings":"AAGA,yFAAyF;AACzF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAgB,EAAE,QAA0B;IAChF,KAAK,MAAM,QAAQ,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;QAC1C,MAAM,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpC,MAAM,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACxC,MAAM,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface ExchangeDescription {
2
+ readonly name: string;
3
+ readonly type: 'topic';
4
+ readonly durable: true;
5
+ }
6
+ //# sourceMappingURL=exchange-description.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange-description.d.ts","sourceRoot":"","sources":["../../src/topology/exchange-description.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=exchange-description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange-description.js","sourceRoot":"","sources":["../../src/topology/exchange-description.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export interface QueueDescription {
2
+ readonly name: string;
3
+ /** `work` is consumed, `retry` holds a failed message for the delay, `dead` keeps it. */
4
+ readonly role: 'work' | 'retry' | 'dead';
5
+ readonly durable: true;
6
+ readonly arguments: Readonly<Record<string, string | number>>;
7
+ }
8
+ //# sourceMappingURL=queue-description.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-description.d.ts","sourceRoot":"","sources":["../../src/topology/queue-description.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;CAC/D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=queue-description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-description.js","sourceRoot":"","sources":["../../src/topology/queue-description.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { ConsumerBinding } from './consumer-binding.js';
2
+ import type { QueueNames } from './queue-names.js';
3
+ export declare function queueNamesOf({ consumer, type }: ConsumerBinding): QueueNames;
4
+ //# sourceMappingURL=queue-names-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-names-of.d.ts","sourceRoot":"","sources":["../../src/topology/queue-names-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG,UAAU,CAI5E"}
@@ -0,0 +1,5 @@
1
+ export function queueNamesOf({ consumer, type }) {
2
+ const work = `${consumer}.${type}`;
3
+ return { work, retry: `${work}.retry`, dead: `${work}.dead` };
4
+ }
5
+ //# sourceMappingURL=queue-names-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-names-of.js","sourceRoot":"","sources":["../../src/topology/queue-names-of.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAmB;IAC9D,MAAM,IAAI,GAAG,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;IAEnC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;AAChE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface QueueNames {
2
+ readonly work: string;
3
+ readonly retry: string;
4
+ readonly dead: string;
5
+ }
6
+ //# sourceMappingURL=queue-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-names.d.ts","sourceRoot":"","sources":["../../src/topology/queue-names.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=queue-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-names.js","sourceRoot":"","sources":["../../src/topology/queue-names.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { BindingDescription } from './binding-description.js';
2
+ import type { ExchangeDescription } from './exchange-description.js';
3
+ import type { QueueDescription } from './queue-description.js';
4
+ /** Everything the bus declares on the broker, as data: for documentation and reviews. */
5
+ export interface RabbitMqTopology {
6
+ readonly exchanges: readonly ExchangeDescription[];
7
+ readonly queues: readonly QueueDescription[];
8
+ readonly bindings: readonly BindingDescription[];
9
+ }
10
+ //# sourceMappingURL=rabbit-mq-topology.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rabbit-mq-topology.d.ts","sourceRoot":"","sources":["../../src/topology/rabbit-mq-topology.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,yFAAyF;AACzF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAClD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rabbit-mq-topology.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rabbit-mq-topology.js","sourceRoot":"","sources":["../../src/topology/rabbit-mq-topology.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ConsumerBinding } from './consumer-binding.js';
2
+ import type { RabbitMqTopology } from './rabbit-mq-topology.js';
3
+ import type { TopologySettings } from './topology-settings.js';
4
+ export declare function topologyOf(settings: TopologySettings, bindings: readonly ConsumerBinding[]): RabbitMqTopology;
5
+ //# sourceMappingURL=topology-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topology-of.d.ts","sourceRoot":"","sources":["../../src/topology/topology-of.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,wBAAgB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,gBAAgB,CAU7G"}
@@ -0,0 +1,50 @@
1
+ import { queueNamesOf } from './queue-names-of.js';
2
+ export function topologyOf(settings, bindings) {
3
+ return {
4
+ exchanges: [{ name: settings.exchange, type: 'topic', durable: true }],
5
+ queues: bindings.flatMap((binding) => queuesOf(settings, queueNamesOf(binding))),
6
+ bindings: bindings.map((binding) => ({
7
+ exchange: settings.exchange,
8
+ queue: queueNamesOf(binding).work,
9
+ routingKey: binding.type,
10
+ })),
11
+ };
12
+ }
13
+ // The default exchange ('') routes to the queue named by the routing key: retries and dead
14
+ // letters reach their queue without an exchange or a binding of their own.
15
+ const DEFAULT_EXCHANGE_OF_THE_BROKER = '';
16
+ function queuesOf(settings, names) {
17
+ const type = { 'x-queue-type': settings.queueType };
18
+ return [
19
+ {
20
+ name: names.work,
21
+ role: 'work',
22
+ durable: true,
23
+ arguments: { ...type, ...deadLetteringTo(names.dead) },
24
+ },
25
+ {
26
+ name: names.retry,
27
+ role: 'retry',
28
+ durable: true,
29
+ arguments: {
30
+ ...type,
31
+ 'x-message-ttl': settings.retryDelayMs,
32
+ ...deadLetteringTo(names.work),
33
+ ...lossless(settings.queueType),
34
+ },
35
+ },
36
+ { name: names.dead, role: 'dead', durable: true, arguments: type },
37
+ ];
38
+ }
39
+ function deadLetteringTo(queue) {
40
+ return {
41
+ 'x-dead-letter-exchange': DEFAULT_EXCHANGE_OF_THE_BROKER,
42
+ 'x-dead-letter-routing-key': queue,
43
+ };
44
+ }
45
+ // A quorum queue dead-letters at most once unless told otherwise: an expired retry must not
46
+ // be lost on its way back. The strategy requires the overflow policy that goes with it.
47
+ function lossless(queueType) {
48
+ return queueType === 'quorum' ? { 'x-dead-letter-strategy': 'at-least-once', 'x-overflow': 'reject-publish' } : {};
49
+ }
50
+ //# sourceMappingURL=topology-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topology-of.js","sourceRoot":"","sources":["../../src/topology/topology-of.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInD,MAAM,UAAU,UAAU,CAAC,QAA0B,EAAE,QA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,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO;QACL,wBAAwB,EAAE,8BAA8B;QACxD,2BAA2B,EAAE,KAAK;KACnC,CAAC;AACJ,CAAC;AAED,4FAA4F;AAC5F,wFAAwF;AACxF,SAAS,QAAQ,CAAC,SAAoB;IACpC,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,wBAAwB,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACrH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { QueueType } from '../options/queue-type.js';
2
+ export interface TopologySettings {
3
+ readonly exchange: string;
4
+ readonly queueType: QueueType;
5
+ readonly retryDelayMs: number;
6
+ }
7
+ //# sourceMappingURL=topology-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topology-settings.d.ts","sourceRoot":"","sources":["../../src/topology/topology-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=topology-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topology-settings.js","sourceRoot":"","sources":["../../src/topology/topology-settings.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "@ddd-ts-kit/rabbitmq",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "RabbitMQ provider for integration events: confirmed publishing for the outbox relay, durable queue per consumer, manual acknowledgement, bounded retries and dead-lettering.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/gbourgeat/ddd-ts-kit.git",
9
+ "directory": "packages/rabbitmq"
10
+ },
11
+ "homepage": "https://github.com/gbourgeat/ddd-ts-kit/tree/main/packages/rabbitmq#readme",
12
+ "bugs": "https://github.com/gbourgeat/ddd-ts-kit/issues",
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "provenance": true
16
+ },
17
+ "type": "module",
18
+ "sideEffects": false,
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "dependencies": {
29
+ "@ddd-ts-kit/kernel": "0.1.1",
30
+ "@ddd-ts-kit/events": "0.1.1"
31
+ },
32
+ "peerDependencies": {
33
+ "amqplib": ">=0.10.0"
34
+ },
35
+ "devDependencies": {
36
+ "amqplib": "latest",
37
+ "@ddd-ts-kit/testing": "0.1.1"
38
+ }
39
+ }