class QueueManager

Manages queue / job dispatch system.

Properties

protected QueueDriverInterface $driver

The driver that is being used.

Methods

__construct()

Constructor for QueueManager class.

void
delete(mixed $jobId)

Delete a job from the queue by its identifier.

void
dispatch(string $jobClass, array $data = [], string|null $queue = null)

Dispatch a new job onto the queue.

void
push(array $payload, string $queue = 'default')

Push a raw payload onto the specified queue.

array|null
pop(string $queue)

Retrieve (pop) the next available job from the specified queue.

void
release(string $queue, array $payload, int $delay = 0)

Release a job back onto the specified queue.

Details

at line 22
__construct()

Constructor for QueueManager class.

at line 50
void delete(mixed $jobId)

Delete a job from the queue by its identifier.

This permanently removes the job record from the underlying queue storage (e.g., deletes the row from the database or removes the entry from Redis).

Parameters

mixed $jobId

The unique identifier of the job to delete. For database drivers, this is typically the row ID.

Return Value

void

at line 67
void dispatch(string $jobClass, array $data = [], string|null $queue = null)

Dispatch a new job onto the queue.

This helper wraps push() by constructing a standard payload with the job class and data. The job class should implement a handle(array $data) method for the worker to call.

Parameters

string $jobClass

Fully-qualified class name of the job handler.

array $data

Data payload for the job.

string|null $queue

Optional queue name (defaults to "default").

Return Value

void

at line 91
void push(array $payload, string $queue = 'default')

Push a raw payload onto the specified queue.

This method directly forwards the payload to the configured queue driver (database or Redis) without modification.

Parameters

array $payload

An associative array representing the job data and metadata.

string $queue

The name of the queue to push the job onto (e.g., "default").

Return Value

void

at line 106
array|null pop(string $queue)

Retrieve (pop) the next available job from the specified queue.

The job is reserved by the driver (e.g., marked with a timestamp or removed from the queue in Redis) so other workers cannot process it.

Parameters

string $queue

The name of the queue to retrieve the job from.

Return Value

array|null

An associative array of the job payload if available, or null if the queue is empty.

at line 123
void release(string $queue, array $payload, int $delay = 0)

Release a job back onto the specified queue.

Useful when a job has failed or needs to be retried after a delay. The payload will be re‑queued and become available again after the specified delay (if supported by the driver).

Parameters

string $queue

The name of the queue to release the job onto.

array $payload

The job payload data to re‑queue.

int $delay

Optional delay in seconds before the job becomes available.

Return Value

void