Documentation

DatabaseQueue extends Queue
in package
implements Queue

Interfaces, Classes and Traits

Queue

Table of Contents

$connectionName  : string
The connection name for the queue.
$container  : Container
The IoC container instance.
$database  : Connection
The database connection instance.
$default  : string
The name of the default queue.
$encrypter  : Encrypter
The encrypter implementation.
$retryAfter  : int|null
The expiration time of a job.
$table  : string
The database table that holds the jobs.
__construct()  : void
Create a new database queue instance.
bulk()  : mixed
Push an array of jobs onto the queue.
deleteReserved()  : void
Delete a reserved job from the queue.
getConnectionName()  : string
Get the connection name for the queue.
getDatabase()  : Connection
Get the underlying database instance.
getJobExpiration()  : mixed
Get the expiration timestamp for an object-based queue handler.
getQueue()  : string
Get the queue or return the default.
later()  : void
Push a new job onto the queue after a delay.
laterOn()  : mixed
Push a new job onto the queue after a delay.
pop()  : Job|null
Pop the next job off of the queue.
push()  : mixed
Push a new job onto the queue.
pushOn()  : mixed
Push a new job onto the queue.
pushRaw()  : mixed
Push a raw payload onto the queue.
release()  : mixed
Release a reserved job back onto the queue.
setConnectionName()  : $this
Set the connection name for the queue.
setContainer()  : void
Set the IoC container instance.
size()  : int
Get the size of the queue.
availableAt()  : int
Get the "available at" UNIX timestamp.
buildDatabaseRecord()  : array<string|int, mixed>
Create an array to insert for the given job.
createObjectPayload()  : array<string|int, mixed>
Create a payload for an object-based queue handler.
createPayload()  : string
Create a payload string from the given job and data.
createPayloadArray()  : array<string|int, mixed>
Create a payload array from the given job and data.
createStringPayload()  : array<string|int, mixed>
Create a typical, string based queue payload array.
currentTime()  : int
Get the current system time as a UNIX timestamp.
getDisplayName()  : string
Get the display name for the given job.
getNextAvailableJob()  : DatabaseJobRecord|null
Get the next available job for the queue.
isAvailable()  : void
Modify the query to check for available jobs.
isReservedButExpired()  : void
Modify the query to check for jobs that are reserved but have expired.
markJobAsReserved()  : DatabaseJobRecord
Mark the given job ID as reserved.
marshalJob()  : DatabaseJob
Marshal the reserved job into a DatabaseJob instance.
parseDateInterval()  : DateTimeInterface|int
If the given value is an interval, convert it to a DateTime instance.
pushToDatabase()  : mixed
Push a raw payload to the database with a given delay.
secondsUntil()  : int
Get the number of seconds until the given DateTime.

Properties

$connectionName

The connection name for the queue.

protected string $connectionName

$default

The name of the default queue.

protected string $default

$retryAfter

The expiration time of a job.

protected int|null $retryAfter = 60

$table

The database table that holds the jobs.

protected string $table

Methods

__construct()

Create a new database queue instance.

public __construct(Connection $database, string $table[, string $default = 'default' ][, int $retryAfter = 60 ]) : void
Parameters
$database : Connection
$table : string
$default : string = 'default'
$retryAfter : int = 60
Return values
void

bulk()

Push an array of jobs onto the queue.

public bulk(array<string|int, mixed> $jobs[, mixed $data = '' ][, string $queue = null ]) : mixed
Parameters
$jobs : array<string|int, mixed>
$data : mixed = ''
$queue : string = null
Return values
mixed

deleteReserved()

Delete a reserved job from the queue.

public deleteReserved(string $queue, string $id) : void
Parameters
$queue : string
$id : string
Tags
throws
Exception|Throwable
Return values
void

getConnectionName()

Get the connection name for the queue.

public getConnectionName() : string
Return values
string

getJobExpiration()

Get the expiration timestamp for an object-based queue handler.

public getJobExpiration(mixed $job) : mixed
Parameters
$job : mixed
Return values
mixed

getQueue()

Get the queue or return the default.

public getQueue(string|null $queue) : string
Parameters
$queue : string|null
Return values
string

later()

Push a new job onto the queue after a delay.

public later(DateTimeInterface|DateInterval|int $delay, string $job[, mixed $data = '' ][, string $queue = null ]) : void
Parameters
$delay : DateTimeInterface|DateInterval|int
$job : string
$data : mixed = ''
$queue : string = null
Return values
void

laterOn()

Push a new job onto the queue after a delay.

public laterOn(string $queue, DateTimeInterface|DateInterval|int $delay, string $job[, mixed $data = '' ]) : mixed
Parameters
$queue : string
$delay : DateTimeInterface|DateInterval|int
$job : string
$data : mixed = ''
Return values
mixed

pop()

Pop the next job off of the queue.

public pop([string $queue = null ]) : Job|null
Parameters
$queue : string = null
Tags
throws
Exception|Throwable
Return values
Job|null

push()

Push a new job onto the queue.

public push(string $job[, mixed $data = '' ][, string $queue = null ]) : mixed
Parameters
$job : string
$data : mixed = ''
$queue : string = null
Return values
mixed

pushOn()

Push a new job onto the queue.

public pushOn(string $queue, string $job[, mixed $data = '' ]) : mixed
Parameters
$queue : string
$job : string
$data : mixed = ''
Return values
mixed

pushRaw()

Push a raw payload onto the queue.

public pushRaw(string $payload[, string $queue = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$payload : string
$queue : string = null
$options : array<string|int, mixed> = []
Return values
mixed

setConnectionName()

Set the connection name for the queue.

public setConnectionName(string $name) : $this
Parameters
$name : string
Return values
$this

setContainer()

Set the IoC container instance.

public setContainer(Container $container) : void
Parameters
$container : Container
Return values
void

size()

Get the size of the queue.

public size([string $queue = null ]) : int
Parameters
$queue : string = null
Return values
int

availableAt()

Get the "available at" UNIX timestamp.

protected availableAt(DateTimeInterface|DateInterval|int $delay) : int
Parameters
$delay : DateTimeInterface|DateInterval|int
Return values
int

buildDatabaseRecord()

Create an array to insert for the given job.

protected buildDatabaseRecord(string|null $queue, string $payload, int $availableAt, int $attempts) : array<string|int, mixed>
Parameters
$queue : string|null
$payload : string
$availableAt : int
$attempts : int
Return values
array<string|int, mixed>

createObjectPayload()

Create a payload for an object-based queue handler.

protected createObjectPayload(mixed $job) : array<string|int, mixed>
Parameters
$job : mixed
Return values
array<string|int, mixed>

createPayload()

Create a payload string from the given job and data.

protected createPayload(string $job[, mixed $data = '' ]) : string
Parameters
$job : string
$data : mixed = ''
Tags
throws
InvalidPayloadException
Return values
string

createPayloadArray()

Create a payload array from the given job and data.

protected createPayloadArray(string $job[, mixed $data = '' ]) : array<string|int, mixed>
Parameters
$job : string
$data : mixed = ''
Return values
array<string|int, mixed>

createStringPayload()

Create a typical, string based queue payload array.

protected createStringPayload(string $job, mixed $data) : array<string|int, mixed>
Parameters
$job : string
$data : mixed
Return values
array<string|int, mixed>

currentTime()

Get the current system time as a UNIX timestamp.

protected currentTime() : int
Return values
int

getDisplayName()

Get the display name for the given job.

protected getDisplayName(mixed $job) : string
Parameters
$job : mixed
Return values
string

isAvailable()

Modify the query to check for available jobs.

protected isAvailable(Builder $query) : void
Parameters
$query : Builder
Return values
void

isReservedButExpired()

Modify the query to check for jobs that are reserved but have expired.

protected isReservedButExpired(Builder $query) : void
Parameters
$query : Builder
Return values
void

parseDateInterval()

If the given value is an interval, convert it to a DateTime instance.

protected parseDateInterval(DateTimeInterface|DateInterval|int $delay) : DateTimeInterface|int
Parameters
$delay : DateTimeInterface|DateInterval|int
Return values
DateTimeInterface|int

pushToDatabase()

Push a raw payload to the database with a given delay.

protected pushToDatabase(string|null $queue, string $payload, DateTimeInterface|DateInterval|int $delay, int $attempts) : mixed
Parameters
$queue : string|null
$payload : string
$delay : DateTimeInterface|DateInterval|int
$attempts : int
Return values
mixed

secondsUntil()

Get the number of seconds until the given DateTime.

protected secondsUntil(DateTimeInterface|DateInterval|int $delay) : int
Parameters
$delay : DateTimeInterface|DateInterval|int
Return values
int

Search results