AMQP (RabbitMQ)
AMQP via RabbitMQ is the production default for distributed deployments. Mature, widely deployed, with excellent tooling.
Why AMQP
Section titled “Why AMQP”| Strength | Benefit |
|---|---|
| Mature | 15+ years of production use |
| Durable queues | Messages survive broker restarts |
| Flexible routing | Topic exchanges, headers, fanout |
| Management UI | Built-in web console |
| Dead letter queues | Automatic failure handling |
Configuration
Section titled “Configuration”[bus]backend = "amqp"
[bus.amqp]url = "amqp://guest:guest@localhost:5672"exchange = "angzarr.events"prefetch_count = 10Environment Variables
Section titled “Environment Variables”export AMQP_URL="amqp://guest:guest@localhost:5672"export BUS_BACKEND="amqp"Exchange Topology
Section titled “Exchange Topology”Angzarr creates a topic exchange for event routing:
flowchart LR
EX["Exchange: angzarr.events<br/>(topic)"]
EX -->|"player.#"| PP[queue: player-projector]
EX -->|"player.#"| OP[queue: output-projector]
EX -->|"hand.#"| HS[queue: hand-saga]
Routing Keys
Section titled “Routing Keys”Events are published with routing keys: {domain}.{event_type}
player.PlayerRegisteredplayer.FundsDepositedhand.CardsDealthand.HandCompleteQueue Configuration
Section titled “Queue Configuration”Each handler gets a dedicated queue with configurable durability:
# Handler queue settingsqueues: player-projector: durable: true auto_delete: false exclusive: false arguments: x-dead-letter-exchange: angzarr.dlxDead Letter Handling
Section titled “Dead Letter Handling”Failed messages route to a dead letter exchange:
flowchart LR
DLX["angzarr.dlx<br/>(fanout)"] --> DLQ["angzarr.dlq<br/>(queue)"]
Monitor the DLQ for processing failures:
# Check DLQ depthrabbitmqctl list_queues name messages | grep dlqHelm Deployment
Section titled “Helm Deployment”bus: backend: amqp
amqp: enabled: true host: rabbitmq.messaging.svc.cluster.local port: 5672 credentials: secretName: rabbitmq-credentials usernameKey: username passwordKey: passwordTesting
Section titled “Testing”# Run AMQP tests (requires testcontainers)cargo test --test bus_amqp --features amqp
# Requires podman socketsystemctl --user start podman.socketManagement Console
Section titled “Management Console”RabbitMQ includes a web management interface:
http://localhost:15672Default credentials: guest/guestMonitor:
- Queue depths
- Message rates
- Consumer connections
- Exchange bindings
When to Use AMQP
Section titled “When to Use AMQP”- Production default — Most deployments
- Existing RabbitMQ — Already in infrastructure
- Complex routing — Headers, topics, fanout
- Operational maturity — Team familiarity
Next Steps
Section titled “Next Steps”- Kafka — High-throughput alternative
- Testcontainers — Container-based testing