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

Providers

PreviousWorker PoolNextSyncProvider

Last updated 2 years ago

A Queue Provider provides a way to serialize jobs to a Queue Connection and to work jobs off a Queue Connection.

The three built-in cbq providers are:

Writing your own Custom Provider

All Queue Providers extend the AbstractQueueProvider base component. They must implement three abstract methods:


/**
 * Persists a serialized job to the Queue Connection
 *
 * @queueName The queue name for the job.
 * @payload   The serialized job string.
 * @delay     The delay (in seconds) before working the job.
 * @attempts  The current attempt number.
 *
 * @return    AbstractQueueProvider
 */
public any function push(
    required string queueName,
    required string payload,
    numeric delay = 0,
    numeric attempts = 0
);

/**
 * Starts a worker for a Worker Pool on this Queue Connection.
 *
 * @pool    The Worker Pool that is working this Queue Connection.
 *
 * @return  A function that when called will stop this worker.
 */
public function function startWorker( required WorkerPool pool );

/**
 * Starts any background processes needed for the Worker Pool.
 *
 * @pool    The Worker Pool that is working this Queue Connection.
 *
 * @return  AbstractQueueProvider
 */
public any function listen( required WorkerPool pool );
SyncProvider@cbq
ColdBoxAsyncProvider@cbq
DBProvider@cbq