The CommandBox CLI is implemented as a single long request in the underlying Lucee server. Due to this it is required to make a unique thread name every call to the task or else an error can occur. The following is an example you can use for running threads.

var threadName = createGUID();
cfthread( action="run" name=threadName) {
  //Thread body
cfthread( action="terminate" name=threadName);


CommandBox bundles WireBox and therefore has access to the AsyncManager library that ColdBox MVC has. It can be used to create async code and even scheduled tasks. CommandBox uses the AsyncManager internally for timed screen redraws.

You can access the AsyncManager class in the variables scope or call the async() method of any Task Runner or custom command.

// Parallel Executions
    () => "/somewhere" ),
    () => "/somewhereElse" ),
    () => "/another" )
).then( (results)=> logResults( results ) );

You can find the full documentation here:

And the API docs here: