Threading/Async
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.
AsyncManager
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.
You can find the full documentation here:
And the API docs here: