Message Broker
debt(d9/e7/b7/t5)
Closest to 'silent in production until users hit it' (d9). detection_hints.automated is explicitly 'no', meaning no tooling catches misuse. Common mistakes like missing acknowledgements or ignoring TTL only manifest as unbounded queue growth or duplicate delivery under load — silent until real traffic exposes them.
Closest to 'cross-cutting refactor across the codebase' (e7). The quick_fix advises choosing the right broker (Kafka vs RabbitMQ vs Redis Streams vs SQS) — a wrong choice or missing acknowledgement patterns typically requires reworking producer and consumer code across multiple services, changing infrastructure configuration, and potentially migrating accumulated messages. This is inherently cross-cutting in a microservices context.
Closest to 'strong gravitational pull' (b7). The term applies_to web, cli, and queue-worker contexts, and tags include microservices. A chosen message broker becomes load-bearing infrastructure: every service that produces or consumes messages is shaped by its topology, acknowledgement model, retention policies, and operational characteristics. Every future service integration must account for the broker's constraints.
Closest to 'notable trap' (t5). The canonical misconception is that message brokers and job queues are the same thing. This is a well-documented gotcha — developers reaching for a full broker (RabbitMQ, Kafka) when a simpler application-level job queue suffices, or vice versa, is a common and consequential error. It contradicts intuition but is widely documented once learned, placing it at t5.
TL;DR
Explanation
Message brokers: Kafka (high-throughput log, replay), RabbitMQ (feature-rich routing, AMQP), Redis Streams (lightweight, Kafka-like), SQS/SNS (AWS managed). Core concepts: producer sends to broker, consumer reads from queue/topic, broker persists until acknowledged. Benefits: decoupling (producers don't know consumers), durability (messages persist), load levelling, retries, dead letter queues. Patterns: point-to-point queue (one consumer gets each message), pub/sub topic (all subscribers get each message). PHP: php-amqplib (RabbitMQ), rdkafka, aws-sdk (SQS), Redis Streams via Predis/PhpRedis.
Common Misconception
Why It Matters
Common Mistakes
- Not acknowledging messages — broker redelivers indefinitely.
- Ignoring message TTL — queue grows unboundedly on consumer failure.
- Using message broker where a job queue suffices — adds operational complexity.
Code Examples
// Synchronous service calls — tight coupling:
$orderService->process($order);
$inventoryService->decrement($items); // Fails? Order partially processed
// Async via message broker:
$bus->dispatch(new OrderPlaced($order->id));
// OrderPlacedHandler runs asynchronously, retried on failure
// InventoryHandler subscribes separately, independently retried