Walkthrough

Install cbq

Refer to the Installation section for general installation instructions as well as instructions for your specific provider.

Create a Queue Connection

Open up your config/cbq.cfc file and create your first Queue Connection:

component {

    function configure() {
        newConnection( "default" )
            .setProvider( "ColdBoxAsyncProvider@cbq" );
    }

}

Create a Worker Pool

Next, create a Worker Pool for your new Queue Connection. This allows our application to work the Jobs we will dispatch.

component {

    function configure() {
        newConnection( "default" )
            .setProvider( "ColdBoxAsyncProvider@cbq" );
            
        newWorkerPool( "default" )
            .forConnection( "default" );
    }

}

Define your first Job

A Job is a CFC that extends cbq.models.Jobs.AbstractJob. It can live anywhere in your application.

Create an instance of your Job

You can create an instance of your Job anywhere in your code — handlers, services, models, etc. Populate it with the specific data needed for this instance.

Dispatch your Job

Once your Job is created and configured, dispatch it to the Queue Connection.

Watch your job get executed

Check out LogBox to see your Job being executed. Congratulations! You've dispatched your first background Job using cbq!