← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Message Queue Patterns

Messaging Intermediate
debt(d9/e7/b7/t7)
d9 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'silent in production until users hit it' (d9). The detection_hints field explicitly states 'automated: no'. Misapplied queue patterns — such as request-reply without timeout or competing consumers on an ordered queue — produce no compiler errors, no linter warnings, and no SAST signals. Problems surface only under real load or when messages are lost/delayed in production.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7). Queue patterns are architectural choices that permeate producer code, consumer code, broker configuration, monitoring, and retry/dead-letter logic. Switching from a naive async-call model to correct named patterns (scatter-gather, competing consumers, dead-letter) requires touching multiple services and infrastructure components — well beyond a single-file fix.

b7 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (e7). The term applies to web, cli, and queue-worker contexts, meaning every part of the system interacts with messaging infrastructure. The chosen patterns shape how producers, consumers, brokers, and monitoring are designed. Every future feature that involves async communication is constrained by the original pattern choices.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap — contradicts how a similar concept works elsewhere' (t7). The canonical misconception states developers treat queues as 'just async function calls', missing the richer pattern space entirely. This directly maps to t7: competent developers familiar with simple async invocation will naturally underestimate queue complexity, leading to real bugs like infinite hangs (request-reply without timeout) or ordering violations (competing consumers on ordered queues).

About DEBT scoring →

TL;DR

Core messaging patterns — competing consumers, scatter-gather, request-reply, message filter, and routing slip — solve recurring distributed communication challenges.

Explanation

Key patterns: (1) Competing consumers: multiple consumers on one queue, each processes different messages — horizontal scaling. (2) Scatter-gather: broadcast to multiple services, aggregate responses. (3) Request-reply: producer sends and waits for reply on a correlation ID — makes async look synchronous. (4) Message filter: consumer silectively processes messages matching criteria. (5) Dead letter: failed messages routed to DLQ. (6) Retry with backoff: failed processing retried with increasing delay. (7) Priority queue: high-priority messages processed first. (8) Message expiry: TTL after which message is discarded. These are from Enterprise Integration Patterns (Hohpe & Woolf).

Common Misconception

Queues are just async function calls — queues enable complex patterns (scatter-gather, correlation, routing) far beyond simple async invocation.

Why It Matters

Knowing named patterns enables choosing the right approach and communicating architecture decisions precisely — 'use scatter-gather here' is clearer than describing it from scratch.

Common Mistakes

  • Request-reply via queue without timeout — hangs forever if reply doesn't come.
  • Competing consumers on an ordered queue — breaks message ordering.
  • Priority queue without monitoring — high-priority messages don't help if consumers are busy.

Code Examples

✗ Vulnerable
// Request-reply without timeout/correlation:
$replyQueue = 'reply.' . uniqid();
$producer->send('service.requests', ['reply_to' => $replyQueue, 'data' => $data]);
$reply = $consumer->waitFor($replyQueue); // Hangs if service is down
✓ Fixed
// Request-reply with timeout and correlation ID:
$correlationId = Uuid::v4();
$producer->send('service.requests', [
    'correlation_id' => $correlationId,
    'reply_to' => 'my-service.replies',
    'data' => $data,
]);
$reply = $consumer->waitFor('my-service.replies', $correlationId, timeout: 5);
if (!$reply) throw new ServiceTimeoutException();

Added 23 Mar 2026
Views 71
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 1 ping T 2 pings F 3 pings S 5 pings S 5 pings M 2 pings T 0 pings W 0 pings T 0 pings F 1 ping S 0 pings S 0 pings M 1 ping T 0 pings W 0 pings T 1 ping F 0 pings S 2 pings S 0 pings M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Scrapy 16 Perplexity 9 Amazonbot 7 Google 5 Ahrefs 4 SEMrush 3 PetalBot 3 Claude 2 Unknown AI 1 ChatGPT 1 Meta AI 1 Majestic 1
crawler 50 crawler_json 3
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Medium
⚡ Quick Fix
Apply named patterns: competing consumers for scale, request-reply for sync-over-async, dead letter for failures, priority queue for urgency. Always add timeouts to request-reply.
📦 Applies To
web cli queue-worker
🔗 Prerequisites
🔍 Detection Hints
Auto-detectable: ✗ No
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: High Context: File


✓ schema.org compliant