Complete Pipeline
This pipeline combines all circuit breaker techniques from this tutorial:
- Multi-level fallback - Primary API → Secondary API → Local buffer → DLQ
- Automatic recovery - Retries with backoff at each level
- No data loss - Failed requests always land somewhere recoverable
Full Configuration
circuit-breakers.yaml
output:
fallback:
# Level 1: Primary API
- http_client:
url: https://primary-api.com/process
timeout: 5s
max_retries: 2
# Level 2: Secondary API
- http_client:
url: https://secondary-api.com/process
timeout: 5s
max_retries: 1
# Level 3: Local buffer
- file:
path: /var/buffer/failed-requests.jsonl
# Level 4: Dead letter queue
- kafka:
addresses: [localhost:9092]
topic: dlq-circuit-breaker-failures
Quick Test
# Test with primary API available
curl -X POST http://localhost:8080/events \
-H "Content-Type: application/json" \
-d '{"event": "test", "data": "hello"}'
# Simulate primary failure - request falls through fallback chain
# Check /var/buffer/failed-requests.jsonl for locally buffered data
Deploy
# Deploy to Expanso orchestrator
expanso-cli job deploy circuit-breakers.yaml
# Or run locally with expanso-edge
expanso-edge run --config circuit-breakers.yaml
Download
Download circuit-breakers.yaml
What's Next?
- Troubleshooting - Common issues and solutions
- Priority Queues - Route by priority level