coldbox-async-programminglisted
Install: claude install-skill ColdBox/skills
# Async Programming (Futures & Executors)
## When to Use This Skill
Use this skill when you need non-blocking operations, parallel workloads, async pipelines, or custom thread-pool management in ColdBox or any standalone Ortus library (WireBox, CacheBox, LogBox).
## Language Mode Reference
Examples use **BoxLang (`.bx`)** syntax by default. Adapt for your target language:
| Concept | BoxLang (`.bx`) | CFML (`.cfc`) |
|---------|-----------------|---------------|
| Class declaration | `class [extends="..."] {` | `component [extends="..."] {` |
| Arrow lambda | `( arg ) => expression` | `( arg ) => expression` |
| Closure | `function() { ... }` | `function() { ... }` |
## Core Concepts
- **AsyncManager** — Central manager accessed via `async()` helper or WireBox injection `@inject "asyncManager@coldbox"`
- **ColdBox Future** — Backed by Java `CompletableFuture`; created via `newFuture()` / `newCompletedFuture()`
- **Executors** — Thread pools (fixed, cached, single, scheduled) registered in AsyncManager
- **Parallel methods** — `all()`, `allApply()`, `anyOf()` for concurrent workloads
- Available in **any** ColdBox/WireBox/CacheBox/LogBox application (not ColdBox-only)
## Accessing the AsyncManager
```boxlang
// In a handler or interceptor — shortcut helper
var future = async().newFuture( () => someService.heavyWork() )
// Via injection
@inject("asyncManager@coldbox")
property name="asyncManager";
// In a non-ColdBox app
application.asyncManager = new coldbox.system.