Implement a circuit breaker pattern for jobs that interact with external services (e.g., APIs, DBs). This helps prevent system overload and cascading failures if a dependency is slow or down.
Goals:
Create a middleware or plugin-style system where circuit breaker can be applied to job handlers.
Use libraries like sony/gobreaker or write a minimal version.
Circuit breaker should:
Open after N failures within a time window.
Prevent further execution for a cooldown period.
Automatically switch back to "closed" if downstream recovers.
Acceptance Criteria:
Circuit breaker can be configured globally or per-job.
Failed jobs due to open circuit should trigger retry/DLQ as usual.
Log transitions between states (open/half-open/closed).
Implement a circuit breaker pattern for jobs that interact with external services (e.g., APIs, DBs). This helps prevent system overload and cascading failures if a dependency is slow or down.
Goals:
Create a middleware or plugin-style system where circuit breaker can be applied to job handlers.
Use libraries like sony/gobreaker or write a minimal version.
Circuit breaker should:
Open after N failures within a time window.
Prevent further execution for a cooldown period.
Automatically switch back to "closed" if downstream recovers.
Acceptance Criteria:
Circuit breaker can be configured globally or per-job.
Failed jobs due to open circuit should trigger retry/DLQ as usual.
Log transitions between states (open/half-open/closed).