@radicaltools/mcp 0.3.0 → 0.3.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.
- package/dist/{chunk-Z7THA3L5.js → chunk-2SZDTOYJ.js} +65 -33
- package/dist/{elkLayout-TAUBPPVN.js → elkLayout-VYJDCCIT.js} +1 -1
- package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
- package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
- package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
- package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
- package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
- package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
- package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
- package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
- package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
- package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
- package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
- package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
- package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
- package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
- package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
- package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
- package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
- package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
- package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
- package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
- package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
- package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
- package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
- package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
- package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
- package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
- package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
- package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
- package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
- package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
- package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
- package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
- package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
- package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
- package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
- package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
- package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
- package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
- package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
- package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
- package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
- package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
- package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
- package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
- package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
- package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
- package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
- package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
- package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
- package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
- package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
- package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
- package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
- package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
- package/dist/index.js +1001 -230
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "concern-messaging",
|
|
4
4
|
"category": "concern",
|
|
5
5
|
"name": "Messaging",
|
|
6
|
-
"description": "Messages through queues and topics: how often each is delivered, whether order matters, which broker carries them, how their schemas change, what happens to one that cannot be handled
|
|
6
|
+
"description": "Messages through queues and topics: how often each is delivered, whether order matters, which broker carries them, how their schemas change, and what happens to one that cannot be handled. That a message and the change it reports are written together is decided in the Data consistency pack.",
|
|
7
7
|
"tags": [
|
|
8
8
|
"messaging",
|
|
9
9
|
"queues",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"rabbitmq",
|
|
13
13
|
"sqs",
|
|
14
14
|
"idempotency",
|
|
15
|
-
"outbox",
|
|
16
15
|
"dead-letter",
|
|
17
16
|
"schema-registry"
|
|
18
17
|
],
|
|
@@ -21,7 +20,7 @@
|
|
|
21
20
|
"id": "messaging",
|
|
22
21
|
"trigger": "LIST NODES WHERE type = \"queue\" AND external != true",
|
|
23
22
|
"why": "messages pass through these queues, so how often each is delivered, in what order, and what happens to one that cannot be handled has to be decided.",
|
|
24
|
-
"group": "
|
|
23
|
+
"group": "architecture"
|
|
25
24
|
},
|
|
26
25
|
"sources": [
|
|
27
26
|
{
|
|
@@ -29,8 +28,8 @@
|
|
|
29
28
|
"url": "https://www.enterpriseintegrationpatterns.com/patterns/messaging/DeadLetterChannel.html"
|
|
30
29
|
},
|
|
31
30
|
{
|
|
32
|
-
"title": "
|
|
33
|
-
"url": "https://
|
|
31
|
+
"title": "Enterprise Integration Patterns, Resequencer",
|
|
32
|
+
"url": "https://www.enterpriseintegrationpatterns.com/patterns/messaging/Resequencer.html"
|
|
34
33
|
},
|
|
35
34
|
{
|
|
36
35
|
"title": "microservices.io, Idempotent Consumer",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
{
|
|
61
60
|
"value": "least",
|
|
62
61
|
"label": "at least once",
|
|
63
|
-
"description": "Nothing is lost: the broker redelivers until a consumer acknowledges, so a message may arrive twice and every consumer must recognise one it has handled
|
|
62
|
+
"description": "Nothing is lost: the broker redelivers until a consumer acknowledges, so a message may arrive twice and every consumer must recognise one it has handled. Pick it whenever a message changes a record: orders, payments, stock."
|
|
64
63
|
},
|
|
65
64
|
{
|
|
66
65
|
"value": "most",
|
|
@@ -166,7 +165,7 @@
|
|
|
166
165
|
"y": 0,
|
|
167
166
|
"kind": "brief",
|
|
168
167
|
"source": "Hub concern pack: Messaging",
|
|
169
|
-
"description": "Parts of the system talk through queues. A message can be delivered twice, lost, arrive out of order, or fail every time it is handled;
|
|
168
|
+
"description": "Parts of the system talk through queues. A message can be delivered twice, lost, arrive out of order, or fail every time it is handled; a producer can change a message so that a consumer released last month cannot read it. Each of these quietly corrupts data, and a stuck consumer looks like silence, unless it is decided how each is handled."
|
|
170
169
|
},
|
|
171
170
|
{
|
|
172
171
|
"id": "req-envelope",
|
|
@@ -175,7 +174,7 @@
|
|
|
175
174
|
"x": 260,
|
|
176
175
|
"y": 0,
|
|
177
176
|
"ears_type": "ubiquitous",
|
|
178
|
-
"action": "give every message a unique id, its type, its schema version, its source, the time it was produced and a correlation id, as CloudEvents attributes",
|
|
177
|
+
"action": "give every message a unique id, its type, its schema version (dataschema), its source, the time it was produced and a correlation id, as CloudEvents attributes",
|
|
179
178
|
"rationale": "Deduplication, ordering checks, tracing and replay all need these, and a common envelope means every consumer finds them in the same place (CloudEvents specification)."
|
|
180
179
|
},
|
|
181
180
|
{
|
|
@@ -193,31 +192,16 @@
|
|
|
193
192
|
]
|
|
194
193
|
}
|
|
195
194
|
},
|
|
196
|
-
{
|
|
197
|
-
"id": "req-outbox",
|
|
198
|
-
"type": "requirement",
|
|
199
|
-
"label": "Message sent with its change",
|
|
200
|
-
"x": 260,
|
|
201
|
-
"y": 260,
|
|
202
|
-
"ears_type": "ubiquitous",
|
|
203
|
-
"action": "write each message to an outbox table in the same database transaction as the change it reports, and relay it to the broker from there, so that neither the change nor the message exists without the other",
|
|
204
|
-
"rationale": "Writing to the database and then to the broker loses one of the two in a crash between; the outbox makes them one write (microservices.io, Transactional outbox).",
|
|
205
|
-
"hubWhen": {
|
|
206
|
-
"DELIVERY": [
|
|
207
|
-
"least"
|
|
208
|
-
]
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
195
|
{
|
|
212
196
|
"id": "req-dlq",
|
|
213
197
|
"type": "requirement",
|
|
214
198
|
"label": "Failing messages set aside",
|
|
215
199
|
"x": 260,
|
|
216
|
-
"y":
|
|
200
|
+
"y": 260,
|
|
217
201
|
"ears_type": "unwanted-behaviour",
|
|
218
202
|
"unwanted_condition": "handling a message fails {{MAX_ATTEMPTS}} times",
|
|
219
|
-
"action": "move it to a dead-letter queue with the error and the number of attempts, go on with the next messages,
|
|
220
|
-
"rationale": "One poisoned message must neither block the rest nor vanish (Enterprise Integration Patterns, Dead Letter Channel).",
|
|
203
|
+
"action": "move it to a dead-letter queue with the error and the number of attempts, go on with the next messages, alert the consumer's owner, and alert again if it is still there after {{DLQ_HOURS}} hours",
|
|
204
|
+
"rationale": "One poisoned message must neither block the rest nor vanish; a dead letter nobody looks at has vanished (Enterprise Integration Patterns, Dead Letter Channel).",
|
|
221
205
|
"hubWhen": {
|
|
222
206
|
"DELIVERY": [
|
|
223
207
|
"least"
|
|
@@ -229,9 +213,9 @@
|
|
|
229
213
|
"type": "requirement",
|
|
230
214
|
"label": "Only losable messages",
|
|
231
215
|
"x": 260,
|
|
232
|
-
"y":
|
|
216
|
+
"y": 390,
|
|
233
217
|
"ears_type": "ubiquitous",
|
|
234
|
-
"action": "carry only message types listed as losable, whose loss changes no record, and drop a message whose handling fails without
|
|
218
|
+
"action": "carry only message types listed as losable, whose loss changes no record, and drop a message whose handling fails without redelivering it, counting the drops per type",
|
|
235
219
|
"rationale": "At-most-once delivery loses messages by design; the list keeps a message that matters from being sent through it by accident.",
|
|
236
220
|
"hubWhen": {
|
|
237
221
|
"DELIVERY": [
|
|
@@ -244,10 +228,10 @@
|
|
|
244
228
|
"type": "requirement",
|
|
245
229
|
"label": "Order kept per key",
|
|
246
230
|
"x": 260,
|
|
247
|
-
"y":
|
|
231
|
+
"y": 520,
|
|
248
232
|
"ears_type": "ubiquitous",
|
|
249
233
|
"action": "publish every message with its key (the order id, the account id), and handle the messages of one key one at a time in the order they were published, while different keys run in parallel",
|
|
250
|
-
"rationale": "Applying \"paid\" before \"created\" breaks the record; order per key keeps it without giving up parallelism across keys (Enterprise Integration Patterns, Resequencer
|
|
234
|
+
"rationale": "Applying \"paid\" before \"created\" breaks the record; order per key keeps it without giving up parallelism across keys (Enterprise Integration Patterns, Resequencer).",
|
|
251
235
|
"hubWhen": {
|
|
252
236
|
"ORDER": [
|
|
253
237
|
"key"
|
|
@@ -259,7 +243,7 @@
|
|
|
259
243
|
"type": "requirement",
|
|
260
244
|
"label": "Stale messages ignored",
|
|
261
245
|
"x": 260,
|
|
262
|
-
"y":
|
|
246
|
+
"y": 650,
|
|
263
247
|
"ears_type": "unwanted-behaviour",
|
|
264
248
|
"unwanted_condition": "a message arrives carrying a version older than the one the record it changes already holds",
|
|
265
249
|
"action": "ignore it and count it, so that the result does not depend on the order of delivery",
|
|
@@ -275,11 +259,11 @@
|
|
|
275
259
|
"type": "requirement",
|
|
276
260
|
"label": "Incompatible schemas refused",
|
|
277
261
|
"x": 260,
|
|
278
|
-
"y":
|
|
262
|
+
"y": 780,
|
|
279
263
|
"ears_type": "event-driven",
|
|
280
264
|
"trigger": "a producer registers a new version of a message schema",
|
|
281
|
-
"action": "check it against every earlier version under the subject's compatibility mode (BACKWARD_TRANSITIVE by default, FULL_TRANSITIVE
|
|
282
|
-
"rationale": "Old messages wait in the queue and are replayed long after; a transitive check keeps every version readable (Confluent, Schema Evolution and Compatibility).",
|
|
265
|
+
"action": "check it against every earlier version under the subject's compatibility mode (BACKWARD_TRANSITIVE by default, FULL_TRANSITIVE where either side may be upgraded first) and refuse an incompatible one before any message uses it",
|
|
266
|
+
"rationale": "Old messages wait in the queue and are replayed long after; a transitive check keeps every version readable. BACKWARD lets consumers upgrade first, FORWARD producers, FULL either (Confluent, Schema Evolution and Compatibility).",
|
|
283
267
|
"hubWhen": {
|
|
284
268
|
"SCHEMA": [
|
|
285
269
|
"registry"
|
|
@@ -291,7 +275,7 @@
|
|
|
291
275
|
"type": "requirement",
|
|
292
276
|
"label": "Breaking schema change refused",
|
|
293
277
|
"x": 260,
|
|
294
|
-
"y":
|
|
278
|
+
"y": 910,
|
|
295
279
|
"ears_type": "unwanted-behaviour",
|
|
296
280
|
"unwanted_condition": "a pull request changes a message in the AsyncAPI document so that a consumer of the last release cannot read it (a field removed, renamed or retyped, or a new required field)",
|
|
297
281
|
"action": "fail the build, and accept the change only as a new message type or channel version published beside the old one",
|
|
@@ -307,7 +291,7 @@
|
|
|
307
291
|
"type": "requirement",
|
|
308
292
|
"label": "Backlog alerted",
|
|
309
293
|
"x": 260,
|
|
310
|
-
"y":
|
|
294
|
+
"y": 1040,
|
|
311
295
|
"ears_type": "unwanted-behaviour",
|
|
312
296
|
"unwanted_condition": "the oldest message waiting for a consumer is older than {{LAG_MINUTES}} minutes",
|
|
313
297
|
"action": "alert the owner of that consumer",
|
|
@@ -321,7 +305,7 @@
|
|
|
321
305
|
"y": 0,
|
|
322
306
|
"given": "each message type a producer sends",
|
|
323
307
|
"when": "one of each is read from the queue",
|
|
324
|
-
"then": "each carries id, type,
|
|
308
|
+
"then": "each carries id, type, dataschema, source, time and correlationid, and no two ids are equal"
|
|
325
309
|
},
|
|
326
310
|
{
|
|
327
311
|
"id": "sc-dedupe",
|
|
@@ -338,30 +322,15 @@
|
|
|
338
322
|
]
|
|
339
323
|
}
|
|
340
324
|
},
|
|
341
|
-
{
|
|
342
|
-
"id": "sc-outbox",
|
|
343
|
-
"type": "scenario",
|
|
344
|
-
"label": "Crash between write and send",
|
|
345
|
-
"x": 520,
|
|
346
|
-
"y": 260,
|
|
347
|
-
"given": "a change committed with its message in the outbox",
|
|
348
|
-
"when": "the process crashes before the message reaches the broker, and restarts",
|
|
349
|
-
"then": "the message is sent after the restart, and a rolled-back change sends nothing",
|
|
350
|
-
"hubWhen": {
|
|
351
|
-
"DELIVERY": [
|
|
352
|
-
"least"
|
|
353
|
-
]
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
325
|
{
|
|
357
326
|
"id": "sc-dlq",
|
|
358
327
|
"type": "scenario",
|
|
359
328
|
"label": "Poison message set aside",
|
|
360
329
|
"x": 520,
|
|
361
|
-
"y":
|
|
330
|
+
"y": 260,
|
|
362
331
|
"given": "a message its consumer always fails on",
|
|
363
|
-
"when": "it has failed {{MAX_ATTEMPTS}} times",
|
|
364
|
-
"then": "it is in the dead-letter queue with its error, the owner is alerted, and the messages behind it are handled",
|
|
332
|
+
"when": "it has failed {{MAX_ATTEMPTS}} times, and {{DLQ_HOURS}} hours pass",
|
|
333
|
+
"then": "it is in the dead-letter queue with its error, the owner is alerted at once and again after {{DLQ_HOURS}} hours, and the messages behind it are handled",
|
|
365
334
|
"hubWhen": {
|
|
366
335
|
"DELIVERY": [
|
|
367
336
|
"least"
|
|
@@ -373,10 +342,10 @@
|
|
|
373
342
|
"type": "scenario",
|
|
374
343
|
"label": "Unlisted type refused",
|
|
375
344
|
"x": 520,
|
|
376
|
-
"y":
|
|
345
|
+
"y": 390,
|
|
377
346
|
"given": "the list of losable message types",
|
|
378
347
|
"when": "a producer sends a type on the list, a type not on it, and a consumer fails on one message",
|
|
379
|
-
"then": "the first is delivered, the second is refused at the producer, and the failed one is dropped and counted",
|
|
348
|
+
"then": "the first is delivered, the second is refused at the producer, and the failed one is delivered once, dropped and counted",
|
|
380
349
|
"hubWhen": {
|
|
381
350
|
"DELIVERY": [
|
|
382
351
|
"most"
|
|
@@ -388,7 +357,7 @@
|
|
|
388
357
|
"type": "scenario",
|
|
389
358
|
"label": "Order of one key kept",
|
|
390
359
|
"x": 520,
|
|
391
|
-
"y":
|
|
360
|
+
"y": 520,
|
|
392
361
|
"given": "three messages for one order published in sequence among a thousand for other orders",
|
|
393
362
|
"when": "four consumers handle them in parallel",
|
|
394
363
|
"then": "the three are handled in the order published",
|
|
@@ -403,7 +372,7 @@
|
|
|
403
372
|
"type": "scenario",
|
|
404
373
|
"label": "Late message ignored",
|
|
405
374
|
"x": 520,
|
|
406
|
-
"y":
|
|
375
|
+
"y": 650,
|
|
407
376
|
"given": "a record at version 3",
|
|
408
377
|
"when": "a message with version 2 for it arrives",
|
|
409
378
|
"then": "the record stays at version 3 and the stale message is counted",
|
|
@@ -418,7 +387,7 @@
|
|
|
418
387
|
"type": "scenario",
|
|
419
388
|
"label": "Removed field refused",
|
|
420
389
|
"x": 520,
|
|
421
|
-
"y":
|
|
390
|
+
"y": 780,
|
|
422
391
|
"given": "a subject in BACKWARD_TRANSITIVE mode with three versions",
|
|
423
392
|
"when": "a producer registers a version that removes a field without a default",
|
|
424
393
|
"then": "the registry refuses it and the producer's build fails",
|
|
@@ -433,7 +402,7 @@
|
|
|
433
402
|
"type": "scenario",
|
|
434
403
|
"label": "Breaking change fails",
|
|
435
404
|
"x": 520,
|
|
436
|
-
"y":
|
|
405
|
+
"y": 910,
|
|
437
406
|
"given": "a pull request that renames a field of a message",
|
|
438
407
|
"when": "the schema check compares it with the last release",
|
|
439
408
|
"then": "the build fails, and passes once the change is a new message version",
|
|
@@ -448,10 +417,10 @@
|
|
|
448
417
|
"type": "scenario",
|
|
449
418
|
"label": "Stuck consumer alerted",
|
|
450
419
|
"x": 520,
|
|
451
|
-
"y":
|
|
452
|
-
"given": "a consumer that has stopped",
|
|
420
|
+
"y": 1040,
|
|
421
|
+
"given": "a consumer that has stopped, and one that runs too slowly",
|
|
453
422
|
"when": "messages wait longer than {{LAG_MINUTES}} minutes",
|
|
454
|
-
"then": "
|
|
423
|
+
"then": "each owner is alerted"
|
|
455
424
|
},
|
|
456
425
|
{
|
|
457
426
|
"id": "adr-least",
|
|
@@ -462,10 +431,10 @@
|
|
|
462
431
|
"concern": "messaging",
|
|
463
432
|
"status": "accepted",
|
|
464
433
|
"date": "",
|
|
465
|
-
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end);
|
|
466
|
-
"decision": "Messages are delivered at least once.
|
|
467
|
-
"consequences": "• No message is lost, and
|
|
468
|
-
"alternatives": "1. At most once: simpler consumers, but messages are lost.\n2. A distributed transaction (XA) across the database and the broker: rarely supported by modern brokers, slow, and couples their availability.\n3. Kafka transactions (exactly-once within Kafka): only for read-process-write that stays inside Kafka; the database
|
|
434
|
+
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end); parallel consumers reorder messages unless order is asked for, and global order does not scale; a message that always fails either blocks the ones behind it or vanishes; producers and consumers are released apart, so a message schema changes while old messages are still waiting; and a backlog grows silently until someone notices that nothing has happened for an hour. Snippets assume the message types with one sample each under src/messages/, the consumers under src/consumers/, schemas under schemas/ (Avro .avsc, Protobuf .proto or JSON Schema .json, one file per subject), and queues defined in Terraform under infra/.",
|
|
435
|
+
"decision": "Messages are delivered at least once. A message and the change it reports are written together through the transactional outbox, as decided in the Data consistency pack. Every message carries CloudEvents attributes; consumers record each id in the transaction of its effect and keep the ids for {{DEDUPE_DAYS}} days. A message that fails {{MAX_ATTEMPTS}} times, with backoff between attempts, goes to a dead-letter queue and its owner is alerted, to replay or discard it within {{DLQ_HOURS}} hours; one still there after that raises a second alert. Consumers handle messages {{ORDER}}.",
|
|
436
|
+
"consequences": "• No message is lost, and a duplicate has the effect of one delivery.\n• Every consumer keeps a table of handled ids, written in the same transaction as its effect.\n• Dead letters need an owner, a tool to replay them and a deadline.",
|
|
437
|
+
"alternatives": "1. At most once: simpler consumers, but messages are lost.\n2. A distributed transaction (XA) across the database and the broker: rarely supported by modern brokers, slow, and couples their availability.\n3. Kafka transactions (exactly-once within Kafka): only for read-process-write that stays inside Kafka; the database side is the Data consistency pack's.",
|
|
469
438
|
"hubWhen": {
|
|
470
439
|
"DELIVERY": [
|
|
471
440
|
"least"
|
|
@@ -481,10 +450,10 @@
|
|
|
481
450
|
"concern": "messaging",
|
|
482
451
|
"status": "accepted",
|
|
483
452
|
"date": "",
|
|
484
|
-
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end);
|
|
453
|
+
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end); parallel consumers reorder messages unless order is asked for, and global order does not scale; a message that always fails either blocks the ones behind it or vanishes; producers and consumers are released apart, so a message schema changes while old messages are still waiting; and a backlog grows silently until someone notices that nothing has happened for an hour. Snippets assume the message types with one sample each under src/messages/, the consumers under src/consumers/, schemas under schemas/ (Avro .avsc, Protobuf .proto or JSON Schema .json, one file per subject), and queues defined in Terraform under infra/. Here the messages are notifications, metrics or hints whose loss changes no record.",
|
|
485
454
|
"decision": "Messages are delivered at most once: acknowledged on receipt (auto-ack, or offsets committed before handling) and never redelivered; a failed message is dropped and counted. Only message types on the losable list, kept in the code, may be published; anything that changes a record needs this decision superseded by at-least-once delivery first. Every message still carries CloudEvents attributes. Consumers handle messages {{ORDER}}.",
|
|
486
455
|
"consequences": "• Simple consumers: no handled-id table, no dead letters, no outbox.\n• A crash or a deployment loses the messages in flight, by design.\n• The losable list is the line to watch: a message that matters must never go through.",
|
|
487
|
-
"alternatives": "1. At least once with idempotent consumers
|
|
456
|
+
"alternatives": "1. At least once with idempotent consumers, as soon as a message matters.\n2. No messaging: notify by a direct call that may fail visibly.",
|
|
488
457
|
"hubWhen": {
|
|
489
458
|
"DELIVERY": [
|
|
490
459
|
"most"
|
|
@@ -500,8 +469,8 @@
|
|
|
500
469
|
"concern": "messaging",
|
|
501
470
|
"status": "accepted",
|
|
502
471
|
"date": "",
|
|
503
|
-
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end);
|
|
504
|
-
"decision": "Messages go through Apache Kafka (managed: Confluent Cloud, Amazon MSK or Aiven; on Kubernetes: Strimzi). Topics are replicated 3 times with min.insync.replicas = 2; producers use acks = all and enable.idempotence = true; retention is at least 7 days so a consumer can replay. Consumers handle messages {{ORDER}}
|
|
472
|
+
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end); parallel consumers reorder messages unless order is asked for, and global order does not scale; a message that always fails either blocks the ones behind it or vanishes; producers and consumers are released apart, so a message schema changes while old messages are still waiting; and a backlog grows silently until someone notices that nothing has happened for an hour. Snippets assume the message types with one sample each under src/messages/, the consumers under src/consumers/, schemas under schemas/ (Avro .avsc, Protobuf .proto or JSON Schema .json, one file per subject), and queues defined in Terraform under infra/.",
|
|
473
|
+
"decision": "Messages go through Apache Kafka (managed: Confluent Cloud, Amazon MSK or Aiven; on Kubernetes: Strimzi). Topics are replicated 3 times with min.insync.replicas = 2; producers use acks = all and enable.idempotence = true; retention is at least 7 days so a consumer can replay. Consumers handle messages {{ORDER}}; where order per key is needed, the message key (the order id, the account id) is the partition key, so the messages of one key stay in order on one partition, and a consumer group's parallelism is its partition count. Kafka has no dead-letter queue of its own: the consumer framework (Spring Kafka DeadLetterPublishingRecoverer, Kafka Connect errors.deadletterqueue) publishes failed messages to a <topic>.dlq topic, the suffix configured (Spring's default is -dlt); a triage consumer group dlq-triage reads the .dlq topics when the owner replays or discards. Consumer lag is exported to Prometheus and alerted at {{LAG_MINUTES}} minutes. Choose Kafka over a queue broker when several consumers read the same stream, replay is needed, or volume is beyond tens of thousands a second.",
|
|
505
474
|
"consequences": "• Any number of consumers can read a topic, each at its own pace, and replay it.\n• Order is per partition only; the partition count bounds parallelism and is hard to change later.\n• Retries and dead letters are the consumer's code, not the broker's.\n• A cluster is heavy to run yourself; managed Kafka costs per partition and throughput.",
|
|
506
475
|
"alternatives": "1. RabbitMQ: routing and per-message dead-lettering built in, but no replay.\n2. Amazon SQS with SNS: nothing to run, but no replay and fan-out through SNS.\n3. Apache Pulsar or Redpanda: Kafka-like logs with other trade-offs (tiered storage, no JVM).",
|
|
507
476
|
"hubWhen": {
|
|
@@ -519,8 +488,8 @@
|
|
|
519
488
|
"concern": "messaging",
|
|
520
489
|
"status": "accepted",
|
|
521
490
|
"date": "",
|
|
522
|
-
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end);
|
|
523
|
-
"decision": "Messages go through RabbitMQ (self-run on three nodes, CloudAMQP or Amazon MQ), on quorum queues so that they survive the loss of a node. Publishers use publisher confirms; consumers acknowledge manually after handling, with a prefetch of 10 to 50. A policy on every queue sets a dead-letter exchange and delivery-limit = {{MAX_ATTEMPTS}}, so a message that keeps failing goes to its <queue>.dlq. Consumers handle messages {{ORDER}}; where order per key is needed, the consistent-hash exchange spreads keys over single-active-consumer queues, so one key always lands in one queue read by one consumer. Queue depth, consumers and dead
|
|
491
|
+
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end); parallel consumers reorder messages unless order is asked for, and global order does not scale; a message that always fails either blocks the ones behind it or vanishes; producers and consumers are released apart, so a message schema changes while old messages are still waiting; and a backlog grows silently until someone notices that nothing has happened for an hour. Snippets assume the message types with one sample each under src/messages/, the consumers under src/consumers/, schemas under schemas/ (Avro .avsc, Protobuf .proto or JSON Schema .json, one file per subject), and queues defined in Terraform under infra/.",
|
|
492
|
+
"decision": "Messages go through RabbitMQ (self-run on three nodes, CloudAMQP or Amazon MQ), on quorum queues so that they survive the loss of a node. Publishers use publisher confirms and set the timestamp property; consumers acknowledge manually after handling, with a prefetch of 10 to 50. A policy on every queue sets a dead-letter exchange and delivery-limit = {{MAX_ATTEMPTS}}, so a message that keeps failing goes to its <queue>.dlq. Consumers handle messages {{ORDER}}; where order per key is needed, the consistent-hash exchange spreads keys over single-active-consumer queues, so one key always lands in one queue read by one consumer. Queue depth, consumers, dead letters and the age of the oldest dead letter are exported through the rabbitmq_prometheus plugin and alerted. Choose RabbitMQ over a log when messages are commands or work items for one consumer each, routing by type matters, and replay is not needed.",
|
|
524
493
|
"consequences": "• Dead-lettering and delivery limits are the broker's, not code.\n• A message is gone once acknowledged: no replay, so read models are rebuilt from the source, not the queue.\n• Order per key costs a queue per hash bucket and one active consumer each.\n• A cluster to run and upgrade, unless bought managed.",
|
|
525
494
|
"alternatives": "1. Apache Kafka: replay and many consumers per stream, but dead letters and routing in code.\n2. Amazon SQS: nothing to run on AWS, less routing.\n3. Azure Service Bus: managed, with sessions for order and dead-lettering built in, on Azure.",
|
|
526
495
|
"hubWhen": {
|
|
@@ -538,9 +507,9 @@
|
|
|
538
507
|
"concern": "messaging",
|
|
539
508
|
"status": "accepted",
|
|
540
509
|
"date": "",
|
|
541
|
-
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end);
|
|
542
|
-
"decision": "Messages go through Amazon SQS, with SNS in front when more than one service consumes a kind of message. Each queue has a redrive policy to its own dead-letter queue with maxReceiveCount = {{MAX_ATTEMPTS}} and a visibility timeout of six times the consumer's handling time. Consumers handle messages {{ORDER}}; where order per key is needed, FIFO queues take the key as MessageGroupId (in high-throughput mode when one queue needs more than 300 messages a second), otherwise standard queues are used. CloudWatch alarms watch ApproximateAgeOfOldestMessage at {{LAG_MINUTES}} minutes
|
|
543
|
-
"consequences": "• Nothing to run or patch; cost per request.\n• Standard queues deliver at least once and out of order; FIFO queues keep order per group at a lower throughput.\n• No replay: a message is gone once deleted.\n• Messages are limited to 256
|
|
510
|
+
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end); parallel consumers reorder messages unless order is asked for, and global order does not scale; a message that always fails either blocks the ones behind it or vanishes; producers and consumers are released apart, so a message schema changes while old messages are still waiting; and a backlog grows silently until someone notices that nothing has happened for an hour. Snippets assume the message types with one sample each under src/messages/, the consumers under src/consumers/, schemas under schemas/ (Avro .avsc, Protobuf .proto or JSON Schema .json, one file per subject), and queues defined in Terraform under infra/.",
|
|
511
|
+
"decision": "Messages go through Amazon SQS, with SNS in front when more than one service consumes a kind of message. Each queue has a redrive policy to its own dead-letter queue with maxReceiveCount = {{MAX_ATTEMPTS}} and a visibility timeout of six times the consumer's handling time. Consumers handle messages {{ORDER}}; where order per key is needed, FIFO queues take the key as MessageGroupId (in high-throughput mode when one queue needs more than 300 messages a second), otherwise standard queues are used. CloudWatch alarms watch ApproximateAgeOfOldestMessage at {{LAG_MINUTES}} minutes on every queue, any message in a dead-letter queue, and a dead letter older than {{DLQ_HOURS}} hours. Queues are defined in Terraform, and a plan check refuses a queue without its redrive policy. Choose SQS on AWS when each queue has one consuming service, replay is not needed, and nobody should run a broker.",
|
|
512
|
+
"consequences": "• Nothing to run or patch; cost per request.\n• Standard queues deliver at least once and out of order; FIFO queues keep order per group at a lower throughput.\n• No replay: a message is gone once deleted.\n• Messages are limited to 1 MiB (256 KiB before August 2025); larger payloads go to S3 with a reference.",
|
|
544
513
|
"alternatives": "1. Amazon Kinesis or MSK: replay and many readers per stream on AWS, more to manage.\n2. Amazon EventBridge: routing by content between many services, with lower throughput per rule.\n3. RabbitMQ on Amazon MQ: richer routing, a broker to size.",
|
|
545
514
|
"hubWhen": {
|
|
546
515
|
"BROKER": [
|
|
@@ -557,8 +526,8 @@
|
|
|
557
526
|
"concern": "messaging",
|
|
558
527
|
"status": "accepted",
|
|
559
528
|
"date": "",
|
|
560
|
-
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end);
|
|
561
|
-
"decision": "Every message type has a schema (Avro or Protobuf; JSON Schema where consumers cannot use either) registered in a schema registry under one subject per topic or message type: Confluent Schema Registry or Apicurio Registry with Kafka, AWS Glue Schema Registry on AWS. Subjects are set to BACKWARD_TRANSITIVE, FULL_TRANSITIVE where
|
|
529
|
+
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end); parallel consumers reorder messages unless order is asked for, and global order does not scale; a message that always fails either blocks the ones behind it or vanishes; producers and consumers are released apart, so a message schema changes while old messages are still waiting; and a backlog grows silently until someone notices that nothing has happened for an hour. Snippets assume the message types with one sample each under src/messages/, the consumers under src/consumers/, schemas under schemas/ (Avro .avsc, Protobuf .proto or JSON Schema .json, one file per subject), and queues defined in Terraform under infra/.",
|
|
530
|
+
"decision": "Every message type has a schema (Avro or Protobuf; JSON Schema where consumers cannot use either) registered in a schema registry under one subject per topic or message type: Confluent Schema Registry or Apicurio Registry with Kafka, AWS Glue Schema Registry on AWS. Subjects are set to BACKWARD_TRANSITIVE (consumers may be upgraded before producers), FULL_TRANSITIVE where either side may be upgraded first. Producers fail to start with an unregistered schema (auto.register.schemas = false in production); CI asks the registry whether a changed schema is compatible before merge. The schema version travels in the message.",
|
|
562
531
|
"consequences": "• An incompatible schema is refused before any message uses it, across teams.\n• Old messages stay readable for as long as they are kept.\n• The registry is on the producer's path at start-up and must be highly available.\n• Removing a field needs a default first; renaming is add-then-remove.",
|
|
563
532
|
"alternatives": "1. Schemas in the repository with an AsyncAPI diff in CI: no registry to run, but only the producer's repository is checked.\n2. Schemaless JSON: nothing to set up, and breaks are found by consumers in production.",
|
|
564
533
|
"hubWhen": {
|
|
@@ -576,7 +545,7 @@
|
|
|
576
545
|
"concern": "messaging",
|
|
577
546
|
"status": "accepted",
|
|
578
547
|
"date": "",
|
|
579
|
-
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end);
|
|
548
|
+
"context": "Parts of the system, or other systems, talk through this queue instead of calling each other. The forces: brokers and networks redeliver, so a message may arrive twice, and avoiding that loses messages instead (exactly once does not exist end to end); parallel consumers reorder messages unless order is asked for, and global order does not scale; a message that always fails either blocks the ones behind it or vanishes; producers and consumers are released apart, so a message schema changes while old messages are still waiting; and a backlog grows silently until someone notices that nothing has happened for an hour. Snippets assume the message types with one sample each under src/messages/, the consumers under src/consumers/, schemas under schemas/ (Avro .avsc, Protobuf .proto or JSON Schema .json, one file per subject), and queues defined in Terraform under infra/.",
|
|
580
549
|
"decision": "Every channel and message is described in an AsyncAPI document with JSON Schema payloads, kept in the producer's repository and released with it. CI compares the document with the last release (AsyncAPI CLI diff) and fails on a breaking change; a breaking change becomes a new message version on the same channel, published beside the old one until consumers have moved. Consumers generate their types from the released document. Choose it over a registry when one team owns the producer and its consumers, or the broker has no registry to hand.",
|
|
581
550
|
"consequences": "• No registry to run; the contract is reviewed with the code.\n• Only the producer's pull requests are checked: a consumer that reads a field the document never promised is not protected.\n• Two versions of a message are published side by side while consumers move.",
|
|
582
551
|
"alternatives": "1. A schema registry: checks at publish time across teams, one more service to run.\n2. Schemaless JSON: nothing to set up, breaks found in production.",
|
|
@@ -587,29 +556,30 @@
|
|
|
587
556
|
}
|
|
588
557
|
},
|
|
589
558
|
{
|
|
590
|
-
"id": "ff-
|
|
559
|
+
"id": "ff-envelope",
|
|
591
560
|
"type": "fitness-fn",
|
|
592
|
-
"label": "
|
|
561
|
+
"label": "Every message is a CloudEvent",
|
|
593
562
|
"x": 1040,
|
|
594
563
|
"y": 0,
|
|
595
|
-
"
|
|
596
|
-
"
|
|
597
|
-
"
|
|
598
|
-
"
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
]
|
|
602
|
-
}
|
|
564
|
+
"characteristic": "compatibility",
|
|
565
|
+
"scope": "atomic",
|
|
566
|
+
"cadence": "triggered",
|
|
567
|
+
"trigger": "pull-request",
|
|
568
|
+
"invocation": "automated",
|
|
569
|
+
"description": "A test constructs a CloudEvent from each message sample (one per type, the same samples the consumers are tested with); the SDK refuses a missing or malformed required attribute, and the test checks the attributes the pack adds.\n\nThreshold: Every message sample validates as a CloudEvent and carries dataschema, time and correlationid; 0 duplicate ids among the samples\n\nTool: Vitest with the cloudevents SDK (or the test runner and CloudEvents SDK of your stack)\n\n```ts\nimport { CloudEvent } from 'cloudevents'\nimport { MESSAGE_SAMPLES } from '../src/messages/samples' // one sample per message type\n\nit('every message type is a valid CloudEvent with schema version, time and correlation id', () => {\n const ids = new Set<string>()\n for (const sample of MESSAGE_SAMPLES) {\n const event = new CloudEvent(sample) // strict: throws ValidationError on a bad envelope\n const attrs = event.toJSON() as Record<string, unknown>\n expect(attrs.dataschema, `${event.type}: dataschema`).toMatch(/^\\S+$/)\n expect(attrs.time, `${event.type}: time`).toMatch(/^\\d{4}-\\d{2}-\\d{2}T/)\n expect(attrs.correlationid, `${event.type}: correlationid`).toMatch(/^\\S+$/)\n expect(ids.has(event.id), `duplicate id ${event.id}`).toBe(false)\n ids.add(event.id)\n }\n})\n```"
|
|
603
570
|
},
|
|
604
571
|
{
|
|
605
|
-
"id": "ff-
|
|
572
|
+
"id": "ff-dupes",
|
|
606
573
|
"type": "fitness-fn",
|
|
607
|
-
"label": "
|
|
574
|
+
"label": "Duplicate delivery harmless",
|
|
608
575
|
"x": 1040,
|
|
609
576
|
"y": 130,
|
|
610
|
-
"
|
|
611
|
-
"
|
|
612
|
-
"
|
|
577
|
+
"characteristic": "reliability",
|
|
578
|
+
"scope": "atomic",
|
|
579
|
+
"cadence": "triggered",
|
|
580
|
+
"trigger": "pull-request",
|
|
581
|
+
"invocation": "automated",
|
|
582
|
+
"description": "An integration test starts the real broker and database in containers, publishes each message type a consumer handles twice with the same id, restarts the consumer, publishes it a third time, and compares the state with a single delivery.\n\nThreshold: Every consumer, given each of its message types twice (and again after a restart), ends in the same state as with one delivery; 0 double effects; 2 duplicates counted\n\nTool: Testcontainers (Kafka, RabbitMQ or LocalStack module) with Vitest (or the test runner of your stack)\n\n```ts\nimport { runWith } from './harness' // starts broker and database with Testcontainers, runs the real consumer\nimport { MESSAGE_SAMPLES } from '../src/messages/samples' // one sample per message type\n\ndescribe.each(MESSAGE_SAMPLES)('$type', (sample) => {\n it('has the effect of one delivery when delivered three times', async () => {\n const once = await runWith([sample])\n const thrice = await runWith([sample, sample], { restart: true, then: [sample] })\n expect(thrice.state).toEqual(once.state)\n expect(thrice.duplicatesCounted).toBe(2)\n })\n})\n```",
|
|
613
583
|
"hubWhen": {
|
|
614
584
|
"DELIVERY": [
|
|
615
585
|
"least"
|
|
@@ -619,12 +589,15 @@
|
|
|
619
589
|
{
|
|
620
590
|
"id": "ff-lossy",
|
|
621
591
|
"type": "fitness-fn",
|
|
622
|
-
"label": "Only losable types
|
|
592
|
+
"label": "Only losable types, failures dropped",
|
|
623
593
|
"x": 1040,
|
|
624
594
|
"y": 260,
|
|
625
|
-
"
|
|
626
|
-
"
|
|
627
|
-
"
|
|
595
|
+
"characteristic": "reliability",
|
|
596
|
+
"scope": "atomic",
|
|
597
|
+
"cadence": "triggered",
|
|
598
|
+
"trigger": "pull-request",
|
|
599
|
+
"invocation": "automated",
|
|
600
|
+
"description": "A test enumerates the message types the producers can publish from their type definitions (not from a list kept by hand) and fails on any that is not on the losable list; a second test, against the real broker in a container, makes the consumer fail on a message and checks that it is delivered once and the drop counter moves.\n\nThreshold: Every message type a producer can publish is on the losable list, 0 off it; a message the consumer fails on is delivered once, never again, and counted as dropped\n\nTool: Vitest with Testcontainers (or the test runner of your stack)\n\n```ts\nimport { PUBLISHED_TYPES } from '../src/messages' // derived from the producers' type union\nimport { LOSABLE } from '../src/messages/losable' // reviewed list: loss changes no record\nimport { runWith } from './harness' // starts the broker with Testcontainers, runs the real consumer\nimport { FAILING_SAMPLE } from '../src/messages/samples' // a message the consumer throws on\n\nit('publishes only message types whose loss changes no record', () => {\n expect(PUBLISHED_TYPES.filter((t) => !LOSABLE.has(t))).toEqual([])\n})\n\nit('drops a failing message after one delivery and counts it', async () => {\n const result = await runWith([FAILING_SAMPLE])\n expect(result.deliveries).toBe(1)\n expect(result.droppedCounted).toBe(1)\n})\n```",
|
|
628
601
|
"hubWhen": {
|
|
629
602
|
"DELIVERY": [
|
|
630
603
|
"most"
|
|
@@ -637,9 +610,12 @@
|
|
|
637
610
|
"label": "Any order, same result",
|
|
638
611
|
"x": 1040,
|
|
639
612
|
"y": 390,
|
|
640
|
-
"
|
|
641
|
-
"
|
|
642
|
-
"
|
|
613
|
+
"characteristic": "reliability",
|
|
614
|
+
"scope": "atomic",
|
|
615
|
+
"cadence": "triggered",
|
|
616
|
+
"trigger": "pull-request",
|
|
617
|
+
"invocation": "automated",
|
|
618
|
+
"description": "A property-based test generates sequences of versioned messages for one record, applies every permutation, and expects the same final state as the ordered sequence.\n\nThreshold: For every message type, all orders of a sequence of 3 versions end in the state of the highest version; 0 differences\n\nTool: fast-check with Vitest (or the property-testing library of your stack)\n\n```ts\nimport fc from 'fast-check'\nimport { apply, emptyState } from '../src/consumers/record'\nimport { arbitraryUpdates } from './arbitraries' // versioned messages for one record\n\nit('ends in the same state whatever the order', () => {\n fc.assert(fc.property(\n arbitraryUpdates(3).chain((updates) =>\n fc.tuple(fc.constant(updates), fc.shuffledSubarray(updates, { minLength: updates.length }))),\n ([updates, shuffled]) => {\n const ordered = [...updates].sort((a, b) => a.version - b.version).reduce(apply, emptyState)\n expect(shuffled.reduce(apply, emptyState)).toEqual(ordered)\n }))\n})\n```",
|
|
643
619
|
"hubWhen": {
|
|
644
620
|
"ORDER": [
|
|
645
621
|
"none"
|
|
@@ -652,9 +628,12 @@
|
|
|
652
628
|
"label": "Order per key holds",
|
|
653
629
|
"x": 1040,
|
|
654
630
|
"y": 520,
|
|
655
|
-
"
|
|
656
|
-
"
|
|
657
|
-
"
|
|
631
|
+
"characteristic": "reliability",
|
|
632
|
+
"scope": "atomic",
|
|
633
|
+
"cadence": "triggered",
|
|
634
|
+
"trigger": "pull-request",
|
|
635
|
+
"invocation": "automated",
|
|
636
|
+
"description": "An integration test against the real broker in a container publishes numbered messages for 100 keys interleaved, runs four consumers, and checks that each key's numbers were handled in increasing order.\n\nThreshold: With 4 consumers in parallel, the messages of each of 100 keys are handled in the order published; 0 out of order\n\nTool: Testcontainers (Kafka, RabbitMQ or LocalStack module) with Vitest (or the test runner of your stack)\n\n```ts\nit('keeps the order within each key', async () => {\n const keys = Array.from({ length: 100 }, (_, i) => 'order-' + i)\n for (let n = 1; n <= 20; n++) for (const key of keys) await publish({ key, n })\n const handled = await consumeWith(4, keys.length * 20) // [{ key, n }] in handling order\n for (const key of keys) {\n const ns = handled.filter((m) => m.key === key).map((m) => m.n)\n expect(ns).toEqual([...ns].sort((a, b) => a - b))\n }\n})\n```",
|
|
658
637
|
"hubWhen": {
|
|
659
638
|
"ORDER": [
|
|
660
639
|
"key"
|
|
@@ -664,12 +643,14 @@
|
|
|
664
643
|
{
|
|
665
644
|
"id": "ff-kafka",
|
|
666
645
|
"type": "fitness-fn",
|
|
667
|
-
"label": "Kafka lag and
|
|
646
|
+
"label": "Kafka lag and dead letters",
|
|
668
647
|
"x": 1040,
|
|
669
648
|
"y": 650,
|
|
670
|
-
"
|
|
671
|
-
"
|
|
672
|
-
"
|
|
649
|
+
"characteristic": "reliability",
|
|
650
|
+
"scope": "atomic",
|
|
651
|
+
"cadence": "continual",
|
|
652
|
+
"invocation": "automated",
|
|
653
|
+
"description": "Prometheus rules over kafka-exporter metrics alert on a stuck consumer group, on a slow one (lag divided by consumption rate), on any message published to a .dlq topic, and on a dead letter the triage group has not consumed within {{DLQ_HOURS}} hours (the owner's replay or discard tool runs as that group). With at-most-once delivery there are no .dlq topics and those two rules stay idle.\n\nThreshold: An alert fires when a consumer group with waiting messages has made no progress for {{LAG_MINUTES}} minutes, or consumes so slowly that its lag is more than {{LAG_MINUTES}} minutes of its own rate; when a dead-letter topic receives a message; and when the dlq-triage group has had a dead letter waiting for {{DLQ_HOURS}} hours\n\nTool: Prometheus alerting rules (kafka-exporter)\n\n```yaml\ngroups:\n- name: messaging\n rules:\n - alert: ConsumerStuck\n expr: kafka_consumergroup_lag_sum > 0\n and delta(kafka_consumergroup_current_offset_sum[{{LAG_MINUTES}}m]) == 0\n labels: { severity: page }\n annotations: { summary: \"{{ $labels.consumergroup }} has not moved for {{LAG_MINUTES}} minutes\" }\n - alert: ConsumerSlow\n expr: kafka_consumergroup_lag_sum / rate(kafka_consumergroup_current_offset_sum[5m]) > {{LAG_MINUTES}} * 60\n for: 5m\n labels: { severity: page }\n annotations: { summary: \"{{ $labels.consumergroup }} is more than {{LAG_MINUTES}} minutes behind at its own rate\" }\n - alert: DeadLetters\n expr: increase(kafka_topic_partition_current_offset{topic=~\".+\\\\.dlq\"}[5m]) > 0\n labels: { severity: ticket }\n - alert: DeadLetterUntriaged\n expr: kafka_consumergroup_lag_sum{consumergroup=\"dlq-triage\"} > 0\n for: {{DLQ_HOURS}}h\n labels: { severity: page }\n annotations: { summary: \"a dead letter on {{ $labels.topic }} has waited {{DLQ_HOURS}} hours\" }\n```",
|
|
673
654
|
"hubWhen": {
|
|
674
655
|
"BROKER": [
|
|
675
656
|
"kafka"
|
|
@@ -682,9 +663,29 @@
|
|
|
682
663
|
"label": "RabbitMQ backlog and dead letters",
|
|
683
664
|
"x": 1040,
|
|
684
665
|
"y": 780,
|
|
685
|
-
"
|
|
686
|
-
"
|
|
687
|
-
"
|
|
666
|
+
"characteristic": "reliability",
|
|
667
|
+
"scope": "atomic",
|
|
668
|
+
"cadence": "continual",
|
|
669
|
+
"invocation": "automated",
|
|
670
|
+
"description": "Prometheus rules over the rabbitmq_prometheus plugin's per-object metrics alert on stuck queues, dead letters, and a dead letter older than {{DLQ_HOURS}} hours (the head timestamp needs the timestamp property set by publishers). With at-most-once delivery there are no .dlq queues and those two rules stay idle.\n\nThreshold: An alert fires when a queue has messages ready and no consumer, or messages ready that have not decreased for {{LAG_MINUTES}} minutes, or any message in a .dlq queue, or a .dlq head message older than {{DLQ_HOURS}} hours\n\nTool: Prometheus alerting rules (rabbitmq_prometheus plugin, per-object metrics)\n\n```yaml\ngroups:\n- name: messaging\n rules:\n - alert: QueueWithoutConsumer\n expr: rabbitmq_queue_messages_ready > 0 and rabbitmq_queue_consumers == 0\n for: {{LAG_MINUTES}}m\n - alert: QueueStuck\n expr: rabbitmq_queue_messages_ready > 0 and delta(rabbitmq_queue_messages_ready[{{LAG_MINUTES}}m]) >= 0\n for: {{LAG_MINUTES}}m\n - alert: DeadLetters\n expr: rabbitmq_queue_messages{queue=~\".+\\\\.dlq\"} > 0\n labels: { severity: ticket }\n - alert: DeadLetterUntriaged\n expr: time() - rabbitmq_queue_head_message_timestamp{queue=~\".+\\\\.dlq\"} > {{DLQ_HOURS}} * 3600\n labels: { severity: page }\n```",
|
|
671
|
+
"hubWhen": {
|
|
672
|
+
"BROKER": [
|
|
673
|
+
"rabbitmq"
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
"id": "ff-rabbitmq-policy",
|
|
679
|
+
"type": "fitness-fn",
|
|
680
|
+
"label": "Every queue quorum with a delivery limit",
|
|
681
|
+
"x": 1040,
|
|
682
|
+
"y": 910,
|
|
683
|
+
"characteristic": "reliability",
|
|
684
|
+
"scope": "atomic",
|
|
685
|
+
"cadence": "triggered",
|
|
686
|
+
"trigger": "nightly",
|
|
687
|
+
"invocation": "automated",
|
|
688
|
+
"description": "A scheduled job reads every queue from the management API and fails on one that is not a quorum queue or whose effective policy lacks the dead-letter exchange or the delivery limit; the policy itself is applied from the repository.\n\nThreshold: Every queue that is not a .dlq is a quorum queue whose effective policy sets a dead-letter exchange and delivery-limit = {{MAX_ATTEMPTS}}; 0 queues without\n\nTool: RabbitMQ management API with curl and jq\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\n# policy, applied from the repository:\n# rabbitmqctl set_policy dlx \".*\" '{\"dead-letter-exchange\":\"dlx\",\"delivery-limit\":{{MAX_ATTEMPTS}}}' --apply-to quorum_queues\nbad=$(curl -sf -u \"$RABBIT_USER:$RABBIT_PASS\" \"$RABBIT_MGMT_URL/api/queues\" | jq -r --argjson max {{MAX_ATTEMPTS}} '\n .[] | select(.name | endswith(\".dlq\") | not)\n | select(.type != \"quorum\"\n or (.effective_policy_definition[\"delivery-limit\"] // -1) != $max\n or ((.effective_policy_definition[\"dead-letter-exchange\"] // \"\") == \"\"))\n | \"\\(.vhost)/\\(.name) (\\(.type))\"')\ntest -z \"$bad\" || { echo \"queues without quorum type or the dead-letter policy:\"; echo \"$bad\"; exit 1; }\n```",
|
|
688
689
|
"hubWhen": {
|
|
689
690
|
"BROKER": [
|
|
690
691
|
"rabbitmq"
|
|
@@ -696,10 +697,30 @@
|
|
|
696
697
|
"type": "fitness-fn",
|
|
697
698
|
"label": "SQS age and dead letters",
|
|
698
699
|
"x": 1040,
|
|
699
|
-
"y":
|
|
700
|
-
"
|
|
701
|
-
"
|
|
702
|
-
"
|
|
700
|
+
"y": 1040,
|
|
701
|
+
"characteristic": "reliability",
|
|
702
|
+
"scope": "atomic",
|
|
703
|
+
"cadence": "continual",
|
|
704
|
+
"invocation": "automated",
|
|
705
|
+
"description": "Each queue, its dead-letter queue and their three CloudWatch alarms are defined together in one Terraform module, so a queue cannot exist without its alarms; the redrive policy itself is checked by the plan policy.\n\nThreshold: An alarm fires when ApproximateAgeOfOldestMessage of a queue exceeds {{LAG_MINUTES}} minutes, when its dead-letter queue holds a message, and when the oldest dead letter is older than {{DLQ_HOURS}} hours\n\nTool: Amazon CloudWatch alarms (Terraform)\n\n```hcl\nresource \"aws_sqs_queue\" \"orders_dlq\" { name = \"orders-dlq\" }\n\nresource \"aws_sqs_queue\" \"orders\" {\n name = \"orders\"\n redrive_policy = jsonencode({ deadLetterTargetArn = aws_sqs_queue.orders_dlq.arn, maxReceiveCount = {{MAX_ATTEMPTS}} })\n}\n\nresource \"aws_cloudwatch_metric_alarm\" \"orders_age\" {\n alarm_name = \"orders-oldest-message\"\n namespace = \"AWS/SQS\"\n metric_name = \"ApproximateAgeOfOldestMessage\"\n dimensions = { QueueName = aws_sqs_queue.orders.name }\n statistic = \"Maximum\"\n period = 60\n evaluation_periods = 1\n threshold = {{LAG_MINUTES}} * 60\n comparison_operator = \"GreaterThanThreshold\"\n}\n\nresource \"aws_cloudwatch_metric_alarm\" \"orders_dead_letters\" {\n alarm_name = \"orders-dead-letters\"\n namespace = \"AWS/SQS\"\n metric_name = \"ApproximateNumberOfMessagesVisible\"\n dimensions = { QueueName = aws_sqs_queue.orders_dlq.name }\n statistic = \"Maximum\"\n period = 60\n evaluation_periods = 1\n threshold = 0\n comparison_operator = \"GreaterThanThreshold\"\n}\n\nresource \"aws_cloudwatch_metric_alarm\" \"orders_dead_letter_age\" {\n alarm_name = \"orders-dead-letter-untriaged\"\n namespace = \"AWS/SQS\"\n metric_name = \"ApproximateAgeOfOldestMessage\"\n dimensions = { QueueName = aws_sqs_queue.orders_dlq.name }\n statistic = \"Maximum\"\n period = 300\n evaluation_periods = 1\n threshold = {{DLQ_HOURS}} * 3600\n comparison_operator = \"GreaterThanThreshold\"\n}\n```",
|
|
706
|
+
"hubWhen": {
|
|
707
|
+
"BROKER": [
|
|
708
|
+
"sqs"
|
|
709
|
+
]
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
"id": "ff-sqs-redrive",
|
|
714
|
+
"type": "fitness-fn",
|
|
715
|
+
"label": "No queue without redrive",
|
|
716
|
+
"x": 1040,
|
|
717
|
+
"y": 1170,
|
|
718
|
+
"characteristic": "reliability",
|
|
719
|
+
"scope": "atomic",
|
|
720
|
+
"cadence": "triggered",
|
|
721
|
+
"trigger": "pull-request",
|
|
722
|
+
"invocation": "automated",
|
|
723
|
+
"description": "A Conftest policy over the Terraform plan fails the pull request on a queue without a redrive policy, or with another maxReceiveCount; a policy only known after apply is reported too, so it is written as a literal.\n\nThreshold: Every aws_sqs_queue in the plan that is not a dead-letter queue has a redrive policy with maxReceiveCount = {{MAX_ATTEMPTS}}; 0 without\n\nTool: Conftest (Open Policy Agent) over terraform show -json\n\n```rego\npackage main\n\nimport rego.v1\n\nqueues contains rc if {\n some rc in input.resource_changes\n rc.type == \"aws_sqs_queue\"\n not endswith(rc.change.after.name, \"-dlq\")\n}\n\ndeny contains msg if {\n some rc in queues\n not rc.change.after.redrive_policy\n msg := sprintf(\"%s has no redrive policy to a dead-letter queue\", [rc.address])\n}\n\ndeny contains msg if {\n some rc in queues\n rc.change.after.redrive_policy\n json.unmarshal(rc.change.after.redrive_policy).maxReceiveCount != {{MAX_ATTEMPTS}}\n msg := sprintf(\"%s sets maxReceiveCount other than {{MAX_ATTEMPTS}}\", [rc.address])\n}\n```",
|
|
703
724
|
"hubWhen": {
|
|
704
725
|
"BROKER": [
|
|
705
726
|
"sqs"
|
|
@@ -711,10 +732,13 @@
|
|
|
711
732
|
"type": "fitness-fn",
|
|
712
733
|
"label": "Schemas compatible before merge",
|
|
713
734
|
"x": 1040,
|
|
714
|
-
"y":
|
|
715
|
-
"
|
|
716
|
-
"
|
|
717
|
-
"
|
|
735
|
+
"y": 1300,
|
|
736
|
+
"characteristic": "compatibility",
|
|
737
|
+
"scope": "atomic",
|
|
738
|
+
"cadence": "triggered",
|
|
739
|
+
"trigger": "pull-request",
|
|
740
|
+
"invocation": "automated",
|
|
741
|
+
"description": "A CI step asks the registry whether each changed Avro, Protobuf or JSON schema is compatible with every version of its subject under the subject's mode, skips subjects that do not exist yet, and fails on the first incompatible one.\n\nThreshold: Every changed schema of an existing subject is compatible with all registered versions under the subject's mode before merge; 0 incompatible registrations; a new subject passes\n\nTool: Confluent Schema Registry compatibility API with curl and jq (Apicurio Registry offers the same check)\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nauth=(-u \"$SR_KEY:$SR_SECRET\")\nfor file in $(git diff --name-only origin/main -- 'schemas/*.avsc' 'schemas/*.proto' 'schemas/*.json'); do\n name=$(basename \"$file\"); subject=\"${name%.*}-value\"\n case \"${name##*.}\" in avsc) type=AVRO ;; proto) type=PROTOBUF ;; json) type=JSON ;; esac\n if ! curl -sf \"${auth[@]}\" \"$SCHEMA_REGISTRY_URL/subjects/$subject/versions\" > /dev/null; then\n echo \"$subject: new subject, nothing to be compatible with\"; continue\n fi\n body=$(jq -n --arg t \"$type\" --rawfile s \"$file\" '{schemaType: $t, schema: $s}')\n curl -sf \"${auth[@]}\" -H 'Content-Type: application/vnd.schemaregistry.v1+json' -d \"$body\" \\\n \"$SCHEMA_REGISTRY_URL/compatibility/subjects/$subject/versions?verbose=true\" \\\n | jq -e '.is_compatible' > /dev/null || { echo \"incompatible: $file\"; exit 1; }\ndone\n```",
|
|
718
742
|
"hubWhen": {
|
|
719
743
|
"SCHEMA": [
|
|
720
744
|
"registry"
|
|
@@ -726,10 +750,13 @@
|
|
|
726
750
|
"type": "fitness-fn",
|
|
727
751
|
"label": "AsyncAPI break check",
|
|
728
752
|
"x": 1040,
|
|
729
|
-
"y":
|
|
730
|
-
"
|
|
731
|
-
"
|
|
732
|
-
"
|
|
753
|
+
"y": 1430,
|
|
754
|
+
"characteristic": "compatibility",
|
|
755
|
+
"scope": "atomic",
|
|
756
|
+
"cadence": "triggered",
|
|
757
|
+
"trigger": "pull-request",
|
|
758
|
+
"invocation": "automated",
|
|
759
|
+
"description": "In every pull request, the AsyncAPI CLI diffs the document with the one of the last release tag, listing only the changes it classifies as breaking, and the step fails when that list is not empty.\n\nThreshold: 0 breaking changes between the last release's AsyncAPI document and the pull request\n\nTool: AsyncAPI CLI (asyncapi diff)\n\n```yaml\n# .github/workflows/messages.yml (a job step; actions/checkout@v4.2.2 with fetch-depth: 0 — pin by commit SHA in your repository)\n- name: No breaking message changes\n run: |\n git show \"$(git describe --tags --abbrev=0)\":asyncapi.yaml > /tmp/base.yaml\n npx @asyncapi/cli diff /tmp/base.yaml asyncapi.yaml --type breaking --format json > /tmp/breaking.json\n jq -e 'length == 0' /tmp/breaking.json\n```",
|
|
733
760
|
"hubWhen": {
|
|
734
761
|
"SCHEMA": [
|
|
735
762
|
"repo"
|
|
@@ -750,12 +777,6 @@
|
|
|
750
777
|
"targetId": "need",
|
|
751
778
|
"relationType": "derives"
|
|
752
779
|
},
|
|
753
|
-
{
|
|
754
|
-
"id": "req-outbox--derives--need",
|
|
755
|
-
"sourceId": "req-outbox",
|
|
756
|
-
"targetId": "need",
|
|
757
|
-
"relationType": "derives"
|
|
758
|
-
},
|
|
759
780
|
{
|
|
760
781
|
"id": "req-dlq--derives--need",
|
|
761
782
|
"sourceId": "req-dlq",
|
|
@@ -810,12 +831,6 @@
|
|
|
810
831
|
"targetId": "req-dedupe",
|
|
811
832
|
"relationType": "verifies"
|
|
812
833
|
},
|
|
813
|
-
{
|
|
814
|
-
"id": "sc-outbox--verifies--req-outbox",
|
|
815
|
-
"sourceId": "sc-outbox",
|
|
816
|
-
"targetId": "req-outbox",
|
|
817
|
-
"relationType": "verifies"
|
|
818
|
-
},
|
|
819
834
|
{
|
|
820
835
|
"id": "sc-dlq--verifies--req-dlq",
|
|
821
836
|
"sourceId": "sc-dlq",
|
|
@@ -859,14 +874,20 @@
|
|
|
859
874
|
"relationType": "verifies"
|
|
860
875
|
},
|
|
861
876
|
{
|
|
862
|
-
"id": "ff-
|
|
863
|
-
"sourceId": "ff-
|
|
877
|
+
"id": "ff-envelope--implements--adr-least",
|
|
878
|
+
"sourceId": "ff-envelope",
|
|
864
879
|
"targetId": "adr-least",
|
|
865
880
|
"relationType": "implements"
|
|
866
881
|
},
|
|
867
882
|
{
|
|
868
|
-
"id": "ff-
|
|
869
|
-
"sourceId": "ff-
|
|
883
|
+
"id": "ff-envelope--implements--adr-most",
|
|
884
|
+
"sourceId": "ff-envelope",
|
|
885
|
+
"targetId": "adr-most",
|
|
886
|
+
"relationType": "implements"
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
"id": "ff-dupes--implements--adr-least",
|
|
890
|
+
"sourceId": "ff-dupes",
|
|
870
891
|
"targetId": "adr-least",
|
|
871
892
|
"relationType": "implements"
|
|
872
893
|
},
|
|
@@ -918,12 +939,24 @@
|
|
|
918
939
|
"targetId": "adr-rabbitmq",
|
|
919
940
|
"relationType": "implements"
|
|
920
941
|
},
|
|
942
|
+
{
|
|
943
|
+
"id": "ff-rabbitmq-policy--implements--adr-rabbitmq",
|
|
944
|
+
"sourceId": "ff-rabbitmq-policy",
|
|
945
|
+
"targetId": "adr-rabbitmq",
|
|
946
|
+
"relationType": "implements"
|
|
947
|
+
},
|
|
921
948
|
{
|
|
922
949
|
"id": "ff-sqs--implements--adr-sqs",
|
|
923
950
|
"sourceId": "ff-sqs",
|
|
924
951
|
"targetId": "adr-sqs",
|
|
925
952
|
"relationType": "implements"
|
|
926
953
|
},
|
|
954
|
+
{
|
|
955
|
+
"id": "ff-sqs-redrive--implements--adr-sqs",
|
|
956
|
+
"sourceId": "ff-sqs-redrive",
|
|
957
|
+
"targetId": "adr-sqs",
|
|
958
|
+
"relationType": "implements"
|
|
959
|
+
},
|
|
927
960
|
{
|
|
928
961
|
"id": "ff-registry--implements--adr-registry",
|
|
929
962
|
"sourceId": "ff-registry",
|