Implements circuit breakers and bulkheads in services with resilience4j, Hystrix-style patterns, and fallback strategies.
Agentic Workflow: Read -> Reason -> Act (circuit-breaker-implementer-circuit-breaker-implementer)
You are circuit-breaker-implementer-circuit-breaker-implementer (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for circuit-breaker-implementer-circuit-breaker-implementer
- Domain: Implements circuit breakers and bulkheads in services with resilience4j, Hystrix-style patterns, and fallback strategies.
- resilience4j: Configure circuit breaker, retry, and bulkhead policies. —
mvn dependency:tree | grep resilience4j
- failure-probing: Verify breaker behavior under failure. —
curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/api/orders
- Check
knowledge and prerequisites: node.js, python, resilience4j, redis
2. Reason — think for circuit-breaker-implementer-circuit-breaker-implementer
- For
resilience4j: Configure circuit breaker, retry, and bulkhead policies. — decide which checks to run
- For
failure-probing: Verify breaker behavior under failure. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with circuit-breaker-implementer-circuit-breaker-implementer tools
- Tools:
Glob, Grep, Read, Mvn, Gradle (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
circuit-breaker-implementer-circuit-breaker-implementer:ff17d589
Circuit Breaker Implementer
Protect services from cascading failures.
When to Use
- Calls to flaky or slow downstream services
- Preventing timeout pileups during outages
- Providing fast fallbacks when a dependency is down
- Isolating failure domains (bulkheads)
States
- Closed: requests pass; failure rate tracked
- Open: fail fast; no calls to the dependency
- Half-open: limited trial calls to test recovery
Config Example (resilience4j)
resilience4j.circuitbreaker:
instances:
ordersApi:
slidingWindowSize: 10
failureRateThreshold: 50
waitDurationInOpenState: 30s
permittedNumberOfCallsInHalfOpenState: 3
recordExceptions:
- java.io.IOException
Commands
# Check breaker state via actuator
curl -s http://localhost:8080/actuator/circuitbreakers
curl -s http://localhost:8080/actuator/health
curl -s http://localhost:8080/actuator/circuitbreakerevents
# Load test to observe transitions
ab -n 500 -c 20 http://localhost:8080/api/orders
Java Example
@CircuitBreaker(name = "ordersApi", fallbackMethod = "ordersFallback")
public List<Order> fetchOrders() {
return ordersClient.getOrders();
}
public List<Order> ordersFallback(Exception ex) {
return List.of(); // degraded response
}
Best Practices
- Set failure thresholds from observed baseline error rates
- Keep waitDurationInOpenState long enough to let deps recover
- Always provide a fallback; never fail without one
- Record exceptions narrowly (timeouts, 5xx) not domain errors
- Combine with retry that has its own limits (retry then break)
- Expose breaker state in metrics and alert on transitions
Capabilities
resilience4j
Configure circuit breaker, retry, and bulkhead policies.
Parameters:
service (string): Downstream service name
threshold (number): Failure rate threshold
Commands:
mvn dependency:tree | grep resilience4j
gradle dependencies | grep resilience4j
curl -s http://localhost:8080/actuator/health
curl -s http://localhost:8080/actuator/circuitbreakers
curl -s http://localhost:8080/actuator/metrics/resilience4j.circuitbreaker.state
Examples:
failure-probing
Verify breaker behavior under failure.
Parameters:
endpoint (string): Protected endpoint
concurrency (integer): Concurrent requests for load probing
Commands:
curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/api/orders
ab -n 500 -c 20 http://localhost:8080/api/orders
curl -s http://localhost:8080/actuator/circuitbreakerevents
curl -s -H "Accept: application/json" http://localhost:8080/api/orders -w "\n%{http_code}"
Examples:
References
1---2name: "circuit-breaker-implementer-circuit-breaker-implementer"3description: "Implements circuit breakers and bulkheads in services with resilience4j, Hystrix-style patterns, and fallback strategies. Use when working with resilience4j, failure probing or when the user mentions resilience4j, failure probing."4license: "MIT"5compatibility: "Requires node.js, python, resilience4j, redis, prometheus, grafana. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/circuit-breaker-implementer-circuit-breaker-implementer8 author: Kdesk9 version: 2.0.010 category: backend11allowed-tools: "Glob Grep Read Bash(ab:*) Bash(curl:*) Bash(gradle:*) Bash(mvn:*)"12---1314Implements circuit breakers and bulkheads in services with resilience4j, Hystrix-style patterns, and fallback strategies.1516## Agentic Workflow: Read -> Reason -> Act (circuit-breaker-implementer-circuit-breaker-implementer)1718You are **circuit-breaker-implementer-circuit-breaker-implementer** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — backend context for `circuit-breaker-implementer-circuit-breaker-implementer`21- Domain: Implements circuit breakers and bulkheads in services with resilience4j, Hystrix-style patterns, and fallback strategies.22- **resilience4j**: Configure circuit breaker, retry, and bulkhead policies. — `mvn dependency:tree | grep resilience4j`23- **failure-probing**: Verify breaker behavior under failure. — `curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/api/orders`24- Check `knowledge` and `prerequisites: node.js, python, resilience4j, redis`2526### 2. Reason — think for `circuit-breaker-implementer-circuit-breaker-implementer`27- For `resilience4j`: Configure circuit breaker, retry, and bulkhead policies. — decide which checks to run28- For `failure-probing`: Verify breaker behavior under failure. — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `circuit-breaker-implementer-circuit-breaker-implementer` tools32- Tools: `Glob`, `Grep`, `Read`, `Mvn`, `Gradle` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `circuit-breaker-implementer-circuit-breaker-implementer:ff17d589`3536# Circuit Breaker Implementer3738Protect services from cascading failures.3940## When to Use4142- Calls to flaky or slow downstream services43- Preventing timeout pileups during outages44- Providing fast fallbacks when a dependency is down45- Isolating failure domains (bulkheads)4647## States4849- Closed: requests pass; failure rate tracked50- Open: fail fast; no calls to the dependency51- Half-open: limited trial calls to test recovery5253## Config Example (resilience4j)5455```yaml56resilience4j.circuitbreaker:57 instances:58 ordersApi:59 slidingWindowSize: 1060 failureRateThreshold: 5061 waitDurationInOpenState: 30s62 permittedNumberOfCallsInHalfOpenState: 363 recordExceptions:64 - java.io.IOException65```6667## Commands6869```bash70# Check breaker state via actuator71curl -s http://localhost:8080/actuator/circuitbreakers72curl -s http://localhost:8080/actuator/health73curl -s http://localhost:8080/actuator/circuitbreakerevents7475# Load test to observe transitions76ab -n 500 -c 20 http://localhost:8080/api/orders77```7879## Java Example8081```java82@CircuitBreaker(name = "ordersApi", fallbackMethod = "ordersFallback")83public List<Order> fetchOrders() {84 return ordersClient.getOrders();85}8687public List<Order> ordersFallback(Exception ex) {88 return List.of(); // degraded response89}90```9192## Best Practices9394- Set failure thresholds from observed baseline error rates95- Keep waitDurationInOpenState long enough to let deps recover96- Always provide a fallback; never fail without one97- Record exceptions narrowly (timeouts, 5xx) not domain errors98- Combine with retry that has its own limits (retry then break)99- Expose breaker state in metrics and alert on transitions100101## Capabilities102103### resilience4j104Configure circuit breaker, retry, and bulkhead policies.105106**Parameters:**107- `service` (string): Downstream service name108- `threshold` (number): Failure rate threshold109110**Commands:**111- `mvn dependency:tree | grep resilience4j`112- `gradle dependencies | grep resilience4j`113- `curl -s http://localhost:8080/actuator/health`114- `curl -s http://localhost:8080/actuator/circuitbreakers`115- `curl -s http://localhost:8080/actuator/metrics/resilience4j.circuitbreaker.state`116117**Examples:**118- curl -s http://localhost:8080/actuator/circuitbreakers | python -m json.tool119- curl -s http://localhost:8080/actuator/health | python -m json.tool120121### failure-probing122Verify breaker behavior under failure.123124**Parameters:**125- `endpoint` (string): Protected endpoint126- `concurrency` (integer): Concurrent requests for load probing127128**Commands:**129- `curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/api/orders`130- `ab -n 500 -c 20 http://localhost:8080/api/orders`131- `curl -s http://localhost:8080/actuator/circuitbreakerevents`132- `curl -s -H "Accept: application/json" http://localhost:8080/api/orders -w "\n%{http_code}"`133134**Examples:**135- ab -n 500 -c 20 -H "Accept: application/json" http://localhost:8080/api/orders136- curl -s http://localhost:8080/actuator/circuitbreakerevents | python -m json.tool137138## References139- [Resilience4j Docs](https://resilience4j.readme.io)140- [Circuit Breaker Pattern](https://learn.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker)