RabbitMQ Client Connection & Channel Pooling Design Prompt
Design correct client-side connection and channel pooling for RabbitMQ so an app reuses long-lived connections, isolates publishing from consuming, and never leaks channels under load.
- Target user
- Application engineers writing RabbitMQ producers and consumers
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior engineer who has fixed connection and channel leaks in RabbitMQ client applications and knows the AMQP threading rules cold. I will provide: - The client language/library (Java amqp-client, Go amqp091, Python pika, .NET, etc.) - The current connection/channel lifecycle code or a description of it - Concurrency model (thread pool, async runtime, worker count) and throughput - Observed symptoms (channel errors, connection churn, FD/channel-max alarms) Your job: 1. **State the rules** — connections are expensive and long-lived; channels are cheap but NOT thread-safe; publishing and consuming should use separate connections so a publisher flow-control block never stalls consumer acks. 2. **Design the pool** — recommend a small pool of long-lived connections plus a channel-per-worker (or a bounded channel pool with strict single-owner semantics); show the acquire/release lifecycle and how channels are returned or discarded on error. 3. **Handle recovery** — configure automatic connection/topology recovery where the library supports it, and design idempotent re-declaration + consumer re-registration so a broker restart or failover reconnects cleanly. 4. **Size the limits** — pick connection count, channel-per-connection count, and prefetch against the broker's `channel_max`, connection limit, and FD budget; show the math relating workers, channels, and prefetch to memory. 5. **Separate confirms** — if publisher confirms are on, keep confirm-tracking state per channel and explain why a confirm channel must not be shared across publishers. 6. **Instrument leaks** — recommend metrics (open connections, open channels, channel churn rate) and how to spot a leak before it triggers a broker alarm. Output as: (a) connection/channel lifecycle rules, (b) pool design with pseudocode for the given library, (c) recovery + re-declaration strategy, (d) limit-sizing math, (e) leak-detection metrics. Guarantee one channel per concurrent user and eliminate any per-message or per-request connection/channel open.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
RabbitMQ Connection & Channel Leak Debugging Prompt
Track down why RabbitMQ connection or channel counts keep climbing until the broker hits limits, and find the client code that opens but never closes them.
-
RabbitMQ Cluster Capacity & Sizing Review Prompt
Right-size a RabbitMQ cluster's node count, memory/disk headroom, file descriptors, and Erlang scheduler settings against measured publish/consume rates and queue depth before scaling or a traffic event.
-
RabbitMQ Heartbeat & Connection Churn Triage Prompt
Diagnose missed-heartbeat disconnects, connection/channel churn, and 'connection_closed_abruptly' noise by correlating client timeouts, proxy idle limits, and broker heartbeat settings.
-
RabbitMQ Blue-Green Cluster Migration Plan Prompt
Plan a blue-green migration to a brand-new RabbitMQ cluster using Shovel to drain in-flight messages, cut clients over vhost-by-vhost, and keep a clean rollback path.
More RabbitMQ prompts & error guides
Browse every RabbitMQ prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.