1. Docker topology
Three brokers. One database. Real work.
Build a disposable PostgreSQL 18.6 cluster, run three active bunqueue brokers, and exercise the public SDK across queues, workers, events, retries, the DLQ, shared limits, and durable job graphs.
Architecture
Section titled “Architecture” PostgreSQL 18.6 authoritative state / | \ broker-a broker-b broker-c producer TCP worker TCP observer TCP \ | / \------ public bunqueue SDK --/ multiple queuesAll brokers use the same PostgreSQL URL and BUNQUEUE_POSTGRES_NAMESPACE.
Each broker has a different, stable BUNQUEUE_BROKER_ID. Clients connect to a
broker over TCP; they never connect directly to PostgreSQL.
Follow the example
Section titled “Follow the example”2. N queues and workers
3. Reliability controls
4. Durable flows
5. Production operations
6. Engineering report
One-command verification
Section titled “One-command verification”From the repository root:
./examples/postgres-multibroker/verify.shThe script creates a unique Compose project, runs each scenario separately with
a 60-second deadline, and installs an exit trap before creating infrastructure.
Success, failure, timeout, SIGINT, and SIGTERM all run ordered, independent
resource and local-image removal attempts. Invalid project overrides are
rejected before Docker is called.
What “N brokers” means
Section titled “What “N brokers” means”The included topology uses three brokers because it is large enough to prove cross-broker behavior without hiding identities behind a load balancer. The same invariants apply to any supported fleet size:
| Setting | Across the fleet |
|---|---|
| PostgreSQL URL | Same authoritative database |
| Namespace | Same for shared queues; different to isolate environments |
| Broker ID | Unique and stable per active broker process |
| TCP/HTTP ports | May be identical inside separate containers |
| PostgreSQL pool | Budget brokers × poolSize, plus operational headroom |
| bunqueue version | Keep identical; mixed-version schema operation is not supported |
Compose cannot safely scale one service definition when it contains one static broker ID. Declare instances explicitly, as this example does, or derive the ID from a stable orchestrator identity such as a Kubernetes Pod name.
This is a functional correctness example, not a benchmark. It proves real PostgreSQL persistence and multi-broker SDK behavior. It does not claim a production capacity number, test PostgreSQL primary failover, or replace the repository’s deeper crash, lease-fencing, contention, and model campaigns.
Next: build the Docker topology.