cbq
2.0.0
2.0.0
  • Home
  • What's New?
  • Getting Started
    • Installation
    • Walkthrough
  • Configuration
    • Module Settings
    • Config File
      • Queue Connection
      • Worker Pool
    • Providers
      • SyncProvider
      • ColdBoxAsyncProvider
      • DBProvider
  • Jobs
    • Defining a Job
    • Creating a Job
    • Dispatching a Job
    • Working a Job
    • Failed Jobs
    • Chained Jobs
    • Batched Jobs
  • cbq Model
  • Other
    • Contributing
    • Contributors
    • Prior Art
    • Dedication
Powered by GitBook
On this page
  1. Configuration
  2. Config File

Worker Pool

PreviousQueue ConnectionNextProviders

Last updated 1 year ago

A Queue Connection is defined inside your cbq config file using a QueueConnectionDefinition builder component. You can create one of these builder components using the method.

WorkerPoolDefinition Methods

setName

Sets the name for the Worker Pool. Usually not called directly as the newWorkerPool method requires a name.

newWorkerPool( "default" )
    .setName( "not-default" );

forConnection

Sets the name of the associated Connection for the Worker Pool. This must reference an already registered Connection.

newConnection( "db" )
    .provider( "DBProvider@cbq" );

newWorkerPool( "db-worker" )
    .forConnection( "db" );

setConnectionName

Alias for .

quantity

Sets the quantity of workers for this Worker Pool.

newWorkerPool( "default" )
    .forConnection( "db" )
    .quantity( 3 );

setQuantity

onQueue

The name of a queue to work. The default queue is named default.

newWorkerPool( "premium-only" )
    .forConnection( "db" )
    .onQueue( "premium" );
    
newWorkerPool( "priority" )
    .forConnection( "db" )
    .onQueue( "priority" )
    .quantity( 4 );
    
newWorkerPool( "default" )
    .forConnection( "db" );
    // uses `default` queue

setQueue

backoff

Sets the backoff time amount, in seconds.

newWorkerPool( "default" )
    .forConnection( "db" )
    .backoff( 30 );

setBackoff

timeout

Sets the timeout time amount, in seconds.

newWorkerPool( "default" )
    .forConnection( "db" )
    .timeout( 60 );

setTimeout

maxAttempts

Sets the max number of attempts.

newWorkerPool( "default" )
    .forConnection( "db" )
    .maxAttempts( 5 );

setMaxAttempts

Alias for .

Alias for .

Alias for .

Alias for .

Alias for .

quantity
onQueue
backoff
timeout
maxAttempts
forConnection
newConnection