coldbox-async-programming

Run parallel tasks and manage thread-pool executors in ColdBox applications.

1|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ColdBox/skills --skill coldbox-async-programming
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coldbox-async-programming
Source: https://github.com/ColdBox/skills/tree/main/coldbox/async-programming
Command: npx skills add https://github.com/ColdBox/skills --skill coldbox-async-programming

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enables non-blocking, parallel execution of work and predictable thread-pool management so HTTP requests remain responsive and long-running or CPU-bound tasks execute safely outside the main request thread. It prevents accidental blocking of the request lifecycle, reduces latency for aggregate operations, and provides controls for timeouts, fallbacks, and executor lifecycle.

Core Features & Use Cases

  • AsyncManager & Futures: Create, chain, complete, and combine ColdBox Futures for asynchronous pipelines and error-safe transformations.
  • Parallel primitives: Run concurrent workloads with all, allApply, and anyOf to wait for every result, map collections in parallel, or pick the fastest response.
  • Executors & scheduling: Register named executors (fixed, cached, single, scheduled), run tasks on custom pools, monitor and shut down executors, and schedule periodic jobs.
  • Use Case: Process large order collections in parallel using allApply with a fixed thread pool to produce mementos, or dispatch fire-and-forget report generation without loading the full application context.

Quick Start

Use coldbox-async-programming to run an allApply over your orders collection with a fixed executor named myWorkers and return the aggregated mementos.

Frequently Asked Questions about coldbox-async-programming

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run parallel tasks in ColdBox without blocking the HTTP request?

Parallel tasks in ColdBox execute asynchronously using non-blocking thread pools and ColdBox Futures backed by Java CompletableFuture. This safely isolates long-running or CPU-bound work from the main HTTP request thread, maintaining responsiveness and reducing latency for aggregate operations.

What is the best way to process a large collection in parallel in ColdBox?

Processing large collections in parallel uses the allApply primitive alongside a named fixed thread-pool executor. This concurrently maps collection elements, such as generating order mementos, while safely managing the executor lifecycle and aggregating results without blocking the request.

Can I schedule periodic background jobs using ColdBox async executors?

ColdBox async executors support scheduling periodic background jobs through registered named pools like fixed, cached, single, or scheduled executors. You configure the executor lifecycle, dispatch fire-and-forget work, and monitor or shut down pools to safely manage recurring tasks.

How do ColdBox Futures handle timeouts and exceptions in async pipelines?

ColdBox Futures handle timeouts and exceptions by chaining asynchronous pipelines with error-safe transformations. They provide built-in controls for timeout thresholds and fallback mechanisms, ensuring async pipelines fail gracefully without crashing the application.

Can I run background tasks in ColdBox without loading the full application context?

ColdBox async programming allows dispatching fire-and-forget tasks without loading the full application context. This option enables lightweight background work execution, bypassing WireBox, CacheBox, and LogBox initialization for faster parallel processing.

When should I use the anyOf parallel primitive instead of all or allApply?

Use the anyOf parallel primitive when you need the fastest response from concurrent operations rather than waiting for every result. Unlike all or allApply which aggregate complete collections, anyOf picks the first completed future to minimize latency for time-sensitive workloads.