DatabaseQueue
Extends
Implements
Properties
$table string
The database table that holds the jobs.
$default string
The name of the default queue.
$retryAfter int|null
The expiration time of a job.
Methods
__construct ( Connection $database , $table , $default , $retryAfter , $dispatchAfterCommit ) : void
Create a new database queue instance.
Parameters
- $database Connection
- $table string
- $default string
- $retryAfter int
- $dispatchAfterCommit bool
size ( $queue ) : int
Get the size of the queue.
Parameters
- $queue string|null
push ( $job , $data , $queue ) : mixed
Push a new job onto the queue.
Parameters
- $job string
- $data mixed
- $queue string|null
pushRaw ( $payload , $queue , array $options ) : mixed
Push a raw payload onto the queue.
Parameters
- $payload string
- $queue string|null
- $options array
later ( $delay , $job , $data , $queue ) : void
Push a new job onto the queue after a delay.
Parameters
- $delay DateTimeInterface |DateInterval |int
- $job string
- $data mixed
- $queue string|null
bulk ( $jobs , $data , $queue ) : mixed
Push an array of jobs onto the queue.
Parameters
- $jobs array
- $data mixed
- $queue string|null
release ( $queue , $job , $delay ) : mixed
Release a reserved job back onto the queue.
Parameters
- $queue string
- $job DatabaseJobRecord
- $delay int
pushToDatabase ( $queue , $payload , $delay , $attempts ) : mixed
Push a raw payload to the database with a given delay.
Parameters
- $queue string|null
- $payload string
- $delay DateTimeInterface |DateInterval |int
- $attempts int
buildDatabaseRecord ( $queue , $payload , $availableAt , $attempts ) : array
Create an array to insert for the given job.
Parameters
- $queue string|null
- $payload string
- $availableAt int
- $attempts int
getNextAvailableJob ( $queue ) : DatabaseJobRecord |null
Get the next available job for the queue.
Parameters
- $queue string|null
getLockForPopping ( ) : string|bool
Get the lock required for popping the next job.
isAvailable ( $query ) : void
Modify the query to check for available jobs.
Parameters
- $query Builder
isReservedButExpired ( $query ) : void
Modify the query to check for jobs that are reserved but have expired.
Parameters
- $query Builder
marshalJob ( $queue , $job ) : DatabaseJob
Marshal the reserved job into a DatabaseJob instance.
Parameters
- $queue string
- $job DatabaseJobRecord
markJobAsReserved ( $job ) : DatabaseJobRecord
Mark the given job ID as reserved.
Parameters
- $job DatabaseJobRecord
deleteReserved ( $queue , $id ) : void
Delete a reserved job from the queue.
Parameters
- $queue string
- $id string
deleteAndRelease ( $queue , $job , $delay ) : void
Delete a reserved job from the reserved queue and release it.
Parameters
- $queue string
- $job DatabaseJob
- $delay int
clear ( $queue ) : int
Delete all of the jobs from the queue.
Parameters
- $queue string
getQueue ( $queue ) : string
Get the queue or return the default.
Parameters
- $queue string|null