Implements bulkhead isolation with opossum (Node.js) and Resilience4j (Java): semaphores, per-dependency pools, and testing.
Agentic Workflow: Read -> Reason -> Act (bulkhead)
You are Bulkhead (api/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for bulkhead
- Domain: Implements bulkhead isolation with opossum (Node.js) and Resilience4j (Java): semaphores, per-dependency pools, and testing.
- opossum-node: Add bulkhead limits to Node.js calls with opossum. —
npm install opossum
- resilience4j-java: Configure Resilience4j bulkheads in Java apps. —
mvn dependency:tree | grep resilience4j-bulkhead
- verify: Load-test bulkhead behavior. —
ab -n 1000 -c 100 http://localhost:8080/api/calls
- Check
knowledge and prerequisites: kubectl, mvn, node, npm
2. Reason — think for bulkhead
- For
opossum-node: Add bulkhead limits to Node.js calls with opossum. — decide which checks to run
- For
resilience4j-java: Configure Resilience4j bulkheads in Java apps. — decide which checks to run
- For
verify: Load-test bulkhead behavior. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with bulkhead tools
- Tools:
Glob, Grep, Read, Bash, Mvn (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
bulkhead:c27ff877
Bulkhead
What this skill does
Implements bulkhead isolation in code: opossum bulkheads for Node.js, Resilience4j bulkheads for Java, and load-test verification that rejected calls fail fast.
When to use
- Limiting concurrent calls to a dependency in application code
- Protecting a service from slow downstreams
- Adding queueing with bounded size
Real commands
# Node.js (opossum)
npm install opossum
node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>42, {maxConcurrent:2}); b.call().then(console.log)"
# Rejection beyond the limit
node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>{await new Promise(r=>setTimeout(r,1000)); return 1},{maxConcurrent:1}); b.call().then(console.log).catch(e=>console.log('rejected', e.message))"
# Java (Resilience4j) metrics
curl -s http://localhost:8080/actuator/metrics/resilience4j.bulkhead.available.concurrent.calls
# Verify with load
ab -n 1000 -c 100 http://localhost:8080/api/calls
Config (resilience4j)
resilience4j.bulkhead:
instances:
db:
maxConcurrentCalls: 10
maxWaitDuration: 100ms
Testing
- Load until rejection rate matches (concurrency - maxConcurrent)
- Assert rejected calls return quickly, not hang
Best practices
- Size bulkhead = dependency concurrency limit
- Expose rejected.calls metrics and alert on them
- Combine with timeouts so queued calls do not pile up
Capabilities
opossum-node
Add bulkhead limits to Node.js calls with opossum.
Parameters:
max_concurrent (number): Max concurrent executions
queue_size (number): Max queued executions
Commands:
npm install opossum
node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>42, {maxConcurrent:2}); b.call().then(console.log)"
node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>{await new Promise(r=>setTimeout(r,1000)); return 1},{maxConcurrent:1}); b.call().then(console.log).catch(e=>console.log('rejected', e.message))"
npm run test
Examples:
- node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>42,{maxConcurrent:2}); Promise.all([b.call(),b.call(),b.call()]).catch(e=>console.log('blocked'))"
- node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>1,{maxConcurrent:1, queue:3, maxQueue:3}); console.log(b.status)"
- node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>1,{maxConcurrent:1}); b.call().then(()=>console.log(b.status.stats.active))"
resilience4j-java
Configure Resilience4j bulkheads in Java apps.
Parameters:
max_concurrent (number): resilience4j bulkhead maxConcurrentCalls
wait_timeout (number): maxWaitDuration
Commands:
mvn dependency:tree | grep resilience4j-bulkhead
mvn test
curl -s http://localhost:8080/actuator/health
curl -s http://localhost:8080/actuator/metrics/resilience4j.bulkhead.available.concurrent.calls
Examples:
verify
Load-test bulkhead behavior.
Parameters:
endpoint (string): Protected endpoint
concurrency (number): Load test concurrency
Commands:
ab -n 1000 -c 100 http://localhost:8080/api/calls
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8080/api/calls
curl -s http://localhost:8080/actuator/metrics/resilience4j.bulkhead.max.allowed.concurrent.calls
kubectl get hpa
Examples:
References
1---2name: "bulkhead"3description: "Implements bulkhead isolation with opossum (Node.js) and Resilience4j (Java): semaphores, per-dependency pools, and testing. Use when working with opossum node, resilience4j java, verify, api or when the user mentions opossum node, resilience4j java, verify, api."4license: "MIT"5compatibility: "Requires kubectl, mvn, node, npm. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/bulkhead8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(ab:*) Bash(curl:*) Bash(kubectl:*) Bash(mvn:*) Bash(node:*) Bash(npm:*)"12---1314Implements bulkhead isolation with opossum (Node.js) and Resilience4j (Java): semaphores, per-dependency pools, and testing.1516## Agentic Workflow: Read -> Reason -> Act (bulkhead)1718You are **Bulkhead** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `bulkhead`21- Domain: Implements bulkhead isolation with opossum (Node.js) and Resilience4j (Java): semaphores, per-dependency pools, and testing.22- **opossum-node**: Add bulkhead limits to Node.js calls with opossum. — `npm install opossum`23- **resilience4j-java**: Configure Resilience4j bulkheads in Java apps. — `mvn dependency:tree | grep resilience4j-bulkhead`24- **verify**: Load-test bulkhead behavior. — `ab -n 1000 -c 100 http://localhost:8080/api/calls`25- Check `knowledge` and `prerequisites: kubectl, mvn, node, npm`2627### 2. Reason — think for `bulkhead`28- For `opossum-node`: Add bulkhead limits to Node.js calls with opossum. — decide which checks to run29- For `resilience4j-java`: Configure Resilience4j bulkheads in Java apps. — decide which checks to run30- For `verify`: Load-test bulkhead behavior. — decide which checks to run31- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3233### 3. Act — execute with `bulkhead` tools34- Tools: `Glob`, `Grep`, `Read`, `Bash`, `Mvn` (see frontmatter `tools`/`allowed-tools`)35- Use `safe_path` for any write; record evidence (paths, checksums)36- Fingerprint: `bulkhead:c27ff877`3738# Bulkhead3940## What this skill does4142Implements bulkhead isolation in code: opossum bulkheads for Node.js, Resilience4j bulkheads for Java, and load-test verification that rejected calls fail fast.4344## When to use4546- Limiting concurrent calls to a dependency in application code47- Protecting a service from slow downstreams48- Adding queueing with bounded size4950## Real commands5152```bash53# Node.js (opossum)54npm install opossum55node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>42, {maxConcurrent:2}); b.call().then(console.log)"5657# Rejection beyond the limit58node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>{await new Promise(r=>setTimeout(r,1000)); return 1},{maxConcurrent:1}); b.call().then(console.log).catch(e=>console.log('rejected', e.message))"5960# Java (Resilience4j) metrics61curl -s http://localhost:8080/actuator/metrics/resilience4j.bulkhead.available.concurrent.calls6263# Verify with load64ab -n 1000 -c 100 http://localhost:8080/api/calls65```6667## Config (resilience4j)6869```yaml70resilience4j.bulkhead:71 instances:72 db:73 maxConcurrentCalls: 1074 maxWaitDuration: 100ms75```7677## Testing7879- Load until rejection rate matches (concurrency - maxConcurrent)80- Assert rejected calls return quickly, not hang8182## Best practices8384- Size bulkhead = dependency concurrency limit85- Expose rejected.calls metrics and alert on them86- Combine with timeouts so queued calls do not pile up8788## Capabilities8990### opossum-node91Add bulkhead limits to Node.js calls with opossum.9293**Parameters:**94- `max_concurrent` (number): Max concurrent executions95- `queue_size` (number): Max queued executions9697**Commands:**98- `npm install opossum`99- `node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>42, {maxConcurrent:2}); b.call().then(console.log)"`100- `node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>{await new Promise(r=>setTimeout(r,1000)); return 1},{maxConcurrent:1}); b.call().then(console.log).catch(e=>console.log('rejected', e.message))"`101- `npm run test`102103**Examples:**104- node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>42,{maxConcurrent:2}); Promise.all([b.call(),b.call(),b.call()]).catch(e=>console.log('blocked'))"105- node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>1,{maxConcurrent:1, queue:3, maxQueue:3}); console.log(b.status)"106- node -e "const opossum=require('opossum'); const b=opossum.bulkhead(async()=>1,{maxConcurrent:1}); b.call().then(()=>console.log(b.status.stats.active))"107108### resilience4j-java109Configure Resilience4j bulkheads in Java apps.110111**Parameters:**112- `max_concurrent` (number): resilience4j bulkhead maxConcurrentCalls113- `wait_timeout` (number): maxWaitDuration114115**Commands:**116- `mvn dependency:tree | grep resilience4j-bulkhead`117- `mvn test`118- `curl -s http://localhost:8080/actuator/health`119- `curl -s http://localhost:8080/actuator/metrics/resilience4j.bulkhead.available.concurrent.calls`120121**Examples:**122- curl -s http://localhost:8080/actuator/metrics/resilience4j.bulkhead.available.concurrent.calls | jq '.measurements'123- mvn test -Dtest=BulkheadTest124- curl -s http://localhost:8080/actuator/health | jq '.components.resilience4jBulkhead'125126### verify127Load-test bulkhead behavior.128129**Parameters:**130- `endpoint` (string): Protected endpoint131- `concurrency` (number): Load test concurrency132133**Commands:**134- `ab -n 1000 -c 100 http://localhost:8080/api/calls`135- `curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8080/api/calls`136- `curl -s http://localhost:8080/actuator/metrics/resilience4j.bulkhead.max.allowed.concurrent.calls`137- `kubectl get hpa`138139**Examples:**140- ab -n 1000 -c 100 http://localhost:8080/api/calls | grep -E 'Non-2xx|Failed'141- curl -s http://localhost:8080/actuator/metrics/resilience4j.bulkhead.rejected.calls | jq '.measurements'142- watch -n1 'curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8080/api/calls'143144## References145- [opossum npm](https://github.com/nodeshift/opossum)146- [Resilience4j Bulkhead](https://resilience4j.readme.io/docs/bulkhead)