class DeferredQueue extends CoroutineQueue

Traits

Properties

protected bool $dispatchViaOutbox

Whether this connection stages jobs through the outbox by default.

from  StagesOutboxJobs
protected Container $container

The IoC container instance.

from  Queue
protected string $connectionName

The connection name for the queue.

from  Queue
protected array $config

The original configuration for the queue.

from  Queue
protected bool $dispatchAfterCommit

Indicates that jobs should be dispatched after the open parent database transactions have committed.

from  Queue
protected null|Queue): mixed): mixed $afterCommitDispatcher

Dispatch an after-commit operation through its live queue owner.

from  Queue
static protected callable[] $createPayloadCallbacks

The create payload callbacks.

from  Queue
protected string $default

The name of the default queue.

protected null|callable $exceptionCallback

The exception callback that should be used for handling uncaught exceptions.

from  CoroutineQueue
protected Timer $timer

The timer used to schedule delayed jobs.

from  CoroutineQueue

Methods

bool
shouldDispatchViaOutbox(object|string $job)

Determine whether the job selects outbox delivery.

mixed
withOutboxForwarding(array|null $forwarded, callable $callback)

Run a child attempt or handler with its own forwarding context.

bool
shouldStageViaOutbox(object|string $job)

Determine whether this driver needs SQL staging for the selected job.

string|null
resolveOutboxCommitConnection(DatabaseTransactionsManager $transactions, object|string $job)

Select an explicit transaction for a local or failover after-commit fallback.

string
enqueueViaOutbox(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay)

Stage a single job through its normal guarded enqueue lifecycle.

array
stageOutboxJobs(array $jobs, mixed $data, string|null $queue)

Stage selected jobs in owner groups and return the direct remainder.

array
prepareOutboxRow(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay)

Build a byte-preserving row from a finalized payload.

string|null
resolveOutboxQueue(string|null $queue)

Expand the logical destination without applying publication-time forwarding.

string
preparePayloadForOutbox(object|string $job, string $payload)

Add metadata required while the original job is still available.

array
prepareOutboxOptions(object|string $job, string|null $queue, string $payload)

Capture transport options that cannot be recovered from the stored envelope.

int
availableAtForOutbox(string|null $queue, int|null $deliverAt)

Determine when a stored message may first be published.

int
secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

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

int
currentTime()

Get the current system time as a UNIX timestamp.

string
runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

mixed
getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

mixed
extractAttributeValue(object $instance)

Extract the value from an attribute instance.

object|null
getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

bool
propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

string|null
resolveConnectionFromQueueRoute(object $queueable, UnitEnum|string|null $queue = null)

Resolve the default connection name for a given queueable instance.

string|null
resolveQueueFromQueueRoute(object $queueable)

Resolve the default queue name for a given queueable instance.

queueRoutes()

Get the queue routes manager instance.

queueRoutesContainer()

Get the container that owns the queue routes.

mixed
pushOn(UnitEnum|string|null $queue, object|string $job, mixed $data = '')

Push a new job onto the queue.

from  Queue
mixed
laterOn(UnitEnum|string|null $queue, DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '')

Push a new job onto a specific queue after (n) seconds.

from  Queue
mixed
bulk(array $jobs, mixed $data = '', UnitEnum|string|null $queue = null)

Push an array of jobs onto the queue.

from  Queue
array
prepareBatchJobs(array $jobs, mixed $data, string|null $queue)

Prepare payloads and delays for a set-based enqueue operation.

from  Queue
mixed
getJobDelay(object|string $job)

Get the delay configured on the given job.

from  Queue
mixed
withLogContext(Repository|null $context, Closure $callback)

Run an operation with its own log context, then restore the caller.

from  Queue
string
createPayload(array|object|string $job, string|null $queue, mixed $data = '', DateInterval|DateTimeInterface|int|null $delay = null)

Create a payload string from the given job and data.

from  Queue
array
createPayloadArray(array|object|string $job, string|null $queue, mixed $data = '')

Create a payload array from the given job and data.

from  Queue
array
createObjectPayload(object $job, string|null $queue)

Create a payload for an object-based queue handler.

from  Queue
string
getDisplayName(object $job)

Get the display name for the given job.

from  Queue
mixed
getJobTries(mixed $job)

Get the maximum number of attempts for an object-based queue handler.

from  Queue
mixed
getJobBackoff(mixed $job)

Get the backoff for an object-based queue handler.

from  Queue
mixed
getJobExpiration(mixed $job)

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

from  Queue
bool
jobShouldBeEncrypted(object $job)

Determine if the job should be encrypted.

from  Queue
array
createStringPayload(array|string $job, string|null $queue, mixed $data)

Create a typical, string based queue payload array.

from  Queue
static void
createPayloadUsing(callable|null $callback)

Register a callback to be executed when creating job payloads.

from  Queue
array
withCreatePayloadHooks(string|null $queue, array $payload)

Create the given payload using any registered payload hooks.

from  Queue
setAfterCommitDispatcher(Closure|null $dispatcher)

Set the dispatcher for after-commit queue operations.

from  Queue
mixed
enqueueUsing(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay, callable $callback)

Enqueue a job using the given callback.

from  Queue
void
deferEnqueueAfterCommit(DatabaseTransactionsManager $transactions, object|string $job, Closure $enqueue)

Honor the selected transaction without resolving outbox storage services.

void
deferBatchEnqueueAfterCommit(DatabaseTransactionsManager $transactions, array $jobs, Closure $enqueue, string|null $connection = null)

Defer a batch enqueue operation until the applicable transaction commits.

from  Queue
static mixed
runDeferredEnqueue(array $jobs, Closure $operation)

Run deferred work with its dispatch locks and optional deferredDispatchFailed job hook.

from  Queue
mixed
enqueueNow(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay, callable $callback)

Enqueue a job immediately using the given callback.

from  Queue
string
preparePayloadForPush(object|string $job, string $payload, string|null $queue)

Prepare a finalized payload for storage without changing lifecycle event correlation.

from  Queue
void
handlePayloadPushed(string $payload, string|null $queue)

Handle a payload after the queue has accepted it.

from  Queue
Throwable|null
notifyBatchMembers(array $members, Closure ...$notifications)

Notify every batch member and return the first ordinary notification failure.

from  Queue
void
notifyBatchMembersOfFailure(array $members, Closure $notification)

Notify every batch member of a failure or cancellation, reporting listener errors so they cannot replace it.

from  Queue
void
reportSecondaryFailure(Throwable $exception)

Report a failure that must not replace the primary error, without swallowing cancellation.

from  Queue
string
finalizePayloadForQueueing(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Finalize an encoded payload immediately before queueing.

from  Queue
array
partitionJobsByAfterCommit(array $jobs, DatabaseTransactionsManager|null $transactions)

Partition jobs by whether they should be deferred until the active transaction commits.

from  Queue
bool
shouldDispatchAfterCommit(object|string $job)

Degrade selected outbox delivery to local execution after commit.

void
addJobRollbackCallback(DatabaseTransactionsManager $transactions, object|string $job, string|null $connection = null)

Register a transaction rollback callback that releases the job's locks.

from  Queue
Closure|null
createJobRollbackCallback(object|string $job)

Create a callback that releases the job's locks.

from  Queue
void
acceptDispatchLocks(object|string $job)

Mark a job's dispatch locks as accepted by the queue.

from  Queue
void
raiseJobQueueingEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Raise the job queueing event.

from  Queue
void
raiseJobQueueingFailedEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay, Throwable $exception, bool $sendAttempted = true)

Raise the job queueing failed event, or the canceled event when cancellation stopped the job.

from  Queue
void
raiseJobQueueingCanceledEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay, Throwable $cancellation, bool $sendAttempted, bool $queued = false, Throwable|null $exception = null)

Raise the job queueing canceled event.

from  Queue
void
raiseJobQueuedEvent(string|null $queue, mixed $jobId, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Raise the job queued event.

from  Queue
string|null
normalizeQueue(UnitEnum|string|null $queue)

Normalize an enum queue name without applying defaults or forwarding.

from  Queue
string
resolveQueue(string $queue)

Get the routed queue name for the given queue.

from  Queue
string
getConnectionName()

Get the connection name for the queue.

from  Queue
setConnectionName(string $name)

Set the connection name for the queue.

from  Queue
array
getConfig()

Get the queue configuration array.

from  Queue
setConfig(array $config)

Set the queue configuration array.

from  Queue
getContainer()

Get the container instance being used by the connection.

from  Queue
setContainer(Container $container)

Set the IoC container instance.

from  Queue
static void
flushState()

Flush all static state.

from  Queue
__construct(bool $dispatchAfterCommit = false, Timer|null $timer = null)

Create a new coroutine queue instance.

int
size(UnitEnum|string|null $queue = null)

Get the size of the queue.

int
pendingSize(UnitEnum|string|null $queue = null)

Get the number of pending jobs.

int
delayedSize(UnitEnum|string|null $queue = null)

Get the number of delayed jobs.

int
reservedSize(UnitEnum|string|null $queue = null)

Get the number of reserved jobs.

int
totalSize()

Get the number of jobs across every queue.

int
totalPendingSize()

Get the number of pending jobs across every queue.

int
totalDelayedSize()

Get the number of delayed jobs across every queue.

int
totalReservedSize()

Get the number of reserved jobs across every queue.

pendingJobs(UnitEnum|string|null $queue = null)

Get the pending jobs for the given queue.

delayedJobs(UnitEnum|string|null $queue = null)

Get the delayed jobs for the given queue.

reservedJobs(UnitEnum|string|null $queue = null)

Get the reserved jobs for the given queue.

allPendingJobs()

Get all pending jobs across every queue.

allDelayedJobs()

Get all delayed jobs across every queue.

allReservedJobs()

Get all reserved jobs across every queue.

int|null
creationTimeOfOldestPendingJob(UnitEnum|string|null $queue = null)

Get the creation timestamp of the oldest pending job, excluding delayed jobs.

mixed
push(object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue.

int
executeJob(object|string $job, mixed $data = '', string|null $queue = null)

Execute a given job synchronously.

int
executePayload(string $payload, string|null $queue = null)

Schedule a serialized job for coroutine execution.

int
processPayload(string $payload, string|null $queue = null)

Process a serialized job payload and raise its lifecycle events.

resolveJob(string $payload, string|null $queue)

Resolve a Sync job instance.

void
raiseBeforeJobEvent(Job $job)

Raise the before queue job event.

void
raiseAfterJobEvent(Job $job, float|null $duration = null)

Raise the after queue job event.

void
raiseJobAttemptedEvent(Job $job, Throwable|null $exceptionOccurred = null, float|null $duration = null, bool $canceled = false)

Raise the job attempted event.

void
raiseExceptionOccurredJobEvent(Job $job, Throwable $e)

Raise the exception occurred queue job event.

void
handleException(Job $queueJob, Throwable $e)

Handle an exception that occurred while processing a job.

mixed
pushRaw(string $payload, UnitEnum|string|null $queue = null, array $options = [])

Push a raw payload onto the queue.

mixed
later(DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue after (n) seconds.

Job|null
pop(UnitEnum|string|null $queue = null)

Pop the next job off of the queue.

setExceptionCallback(callable|null $callback)

Set the exception callback for the coroutine queue.

int
scheduleJob(DateInterval|DateTimeInterface|int $delay, object|string $job, string $payload, string|null $queue)

Schedule a delayed job with its dispatch-time payload.

int
scheduleTimer(DateInterval|DateTimeInterface|int $delay, string $payload, string|null $queue, array|null $snapshot)

Schedule the timer that will execute the job after the delay.

void
scheduleExecution(Closure $execution)

Defer the given execution callback.

Details

in StagesOutboxJobs at line 32
protected bool shouldDispatchViaOutbox(object|string $job)

Determine whether the job selects outbox delivery.

Parameters

object|string $job

Return Value

bool

in StagesOutboxJobs at line 44
protected mixed withOutboxForwarding(array|null $forwarded, callable $callback)

Run a child attempt or handler with its own forwarding context.

Parameters

array|null $forwarded
callable $callback

Return Value

mixed

in StagesOutboxJobs at line 68
protected bool shouldStageViaOutbox(object|string $job)

Determine whether this driver needs SQL staging for the selected job.

Parameters

object|string $job

Return Value

bool

in StagesOutboxJobs at line 76
protected string|null resolveOutboxCommitConnection(DatabaseTransactionsManager $transactions, object|string $job)

Select an explicit transaction for a local or failover after-commit fallback.

Parameters

DatabaseTransactionsManager $transactions
object|string $job

Return Value

string|null

in StagesOutboxJobs at line 97
protected string enqueueViaOutbox(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay)

Stage a single job through its normal guarded enqueue lifecycle.

Parameters

object|string $job
string $payload
string|null $queue
DateInterval|DateTimeInterface|int|null $delay

Return Value

string

in StagesOutboxJobs at line 124
protected array stageOutboxJobs(array $jobs, mixed $data, string|null $queue)

Stage selected jobs in owner groups and return the direct remainder.

Parameters

array $jobs
mixed $data
string|null $queue

Return Value

array

in StagesOutboxJobs at line 207
protected array prepareOutboxRow(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay)

Build a byte-preserving row from a finalized payload.

Parameters

object|string $job
string $payload
string|null $queue
DateInterval|DateTimeInterface|int|null $delay

Return Value

array

in StagesOutboxJobs at line 245
protected string|null resolveOutboxQueue(string|null $queue)

Expand the logical destination without applying publication-time forwarding.

Parameters

string|null $queue

Return Value

string|null

in StagesOutboxJobs at line 253
protected string preparePayloadForOutbox(object|string $job, string $payload)

Add metadata required while the original job is still available.

Parameters

object|string $job
string $payload

Return Value

string

in StagesOutboxJobs at line 261
protected array prepareOutboxOptions(object|string $job, string|null $queue, string $payload)

Capture transport options that cannot be recovered from the stored envelope.

Parameters

object|string $job
string|null $queue
string $payload

Return Value

array

in StagesOutboxJobs at line 269
protected int availableAtForOutbox(string|null $queue, int|null $deliverAt)

Determine when a stored message may first be published.

Parameters

string|null $queue
int|null $deliverAt

Return Value

int

in InteractsWithTime at line 17
protected int secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateInterval|DateTimeInterface|int $delay

Return Value

int

in InteractsWithTime at line 29
protected int availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

int

in InteractsWithTime at line 47
protected DateTimeInterface|int parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

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

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

DateTimeInterface|int

in InteractsWithTime at line 63
protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

in InteractsWithTime at line 71
protected string runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

Parameters

float $startTime
float|null $endTime

Return Value

string

protected mixed getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

Parameters

object $target
string $attributeClass
string|null $property
mixed $default

Return Value

mixed

protected mixed extractAttributeValue(object $instance)

Extract the value from an attribute instance.

Parameters

object $instance

Return Value

mixed

protected object|null getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

Parameters

object $target
string $attributeClass
ReflectionClass|null $declaringClass

Return Value

object|null

protected bool propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

Parameters

object $target
ReflectionClass $reflection
string|null $property
ReflectionClass $attributeDeclaringClass

Return Value

bool

string|null resolveConnectionFromQueueRoute(object $queueable, UnitEnum|string|null $queue = null)

Resolve the default connection name for a given queueable instance.

Parameters

object $queueable
UnitEnum|string|null $queue

the caller-selected queue, overriding the queueable's queue when resolving a forwarded connection

Return Value

string|null

string|null resolveQueueFromQueueRoute(object $queueable)

Resolve the default queue name for a given queueable instance.

Parameters

object $queueable

Return Value

string|null

protected QueueRoutes queueRoutes()

Get the queue routes manager instance.

Return Value

QueueRoutes

protected Container queueRoutesContainer()

Get the container that owns the queue routes.

Return Value

Container

in Queue at line 98
mixed pushOn(UnitEnum|string|null $queue, object|string $job, mixed $data = '')

Push a new job onto the queue.

Parameters

UnitEnum|string|null $queue
object|string $job
mixed $data

Return Value

mixed

in Queue at line 106
mixed laterOn(UnitEnum|string|null $queue, DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '')

Push a new job onto a specific queue after (n) seconds.

Parameters

UnitEnum|string|null $queue
DateInterval|DateTimeInterface|int $delay
object|string $job
mixed $data

Return Value

mixed

in Queue at line 114
mixed bulk(array $jobs, mixed $data = '', UnitEnum|string|null $queue = null)

Push an array of jobs onto the queue.

Parameters

array $jobs
mixed $data
UnitEnum|string|null $queue

Return Value

mixed

in Queue at line 137
protected array prepareBatchJobs(array $jobs, mixed $data, string|null $queue)

Prepare payloads and delays for a set-based enqueue operation.

Parameters

array $jobs
mixed $data
string|null $queue

Return Value

array

in Queue at line 156
protected mixed getJobDelay(object|string $job)

Get the delay configured on the given job.

Parameters

object|string $job

Return Value

mixed

in Queue at line 170
protected mixed withLogContext(Repository|null $context, Closure $callback)

Run an operation with its own log context, then restore the caller.

Parameters

Repository|null $context
Closure $callback

Return Value

mixed

in Queue at line 193
protected string createPayload(array|object|string $job, string|null $queue, mixed $data = '', DateInterval|DateTimeInterface|int|null $delay = null)

Create a payload string from the given job and data.

Parameters

array|object|string $job
string|null $queue
mixed $data
DateInterval|DateTimeInterface|int|null $delay

Return Value

string

Exceptions

InvalidPayloadException

in Queue at line 226
protected array createPayloadArray(array|object|string $job, string|null $queue, mixed $data = '')

Create a payload array from the given job and data.

Parameters

array|object|string $job
string|null $queue
mixed $data

Return Value

array

in Queue at line 238
protected array createObjectPayload(object $job, string|null $queue)

Create a payload for an object-based queue handler.

Parameters

object $job
string|null $queue

Return Value

array

Exceptions

RuntimeException

in Queue at line 309
protected string getDisplayName(object $job)

Get the display name for the given job.

Parameters

object $job

Return Value

string

in Queue at line 319
mixed getJobTries(mixed $job)

Get the maximum number of attempts for an object-based queue handler.

Parameters

mixed $job

Return Value

mixed

in Queue at line 333
mixed getJobBackoff(mixed $job)

Get the backoff for an object-based queue handler.

Parameters

mixed $job

Return Value

mixed

in Queue at line 353
mixed getJobExpiration(mixed $job)

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

Parameters

mixed $job

Return Value

mixed

in Queue at line 369
protected bool jobShouldBeEncrypted(object $job)

Determine if the job should be encrypted.

Parameters

object $job

Return Value

bool

in Queue at line 381
protected array createStringPayload(array|string $job, string|null $queue, mixed $data)

Create a typical, string based queue payload array.

Parameters

array|string $job
string|null $queue
mixed $data

Return Value

array

in Queue at line 406
static void createPayloadUsing(callable|null $callback)

Register a callback to be executed when creating job payloads.

The callback persists in a static property for the worker lifetime and runs on every subsequent payload creation across all coroutines. Passing null clears the registry.

Parameters

callable|null $callback

Return Value

void

in Queue at line 419
protected array withCreatePayloadHooks(string|null $queue, array $payload)

Create the given payload using any registered payload hooks.

Parameters

string|null $queue
array $payload

Return Value

array

in Queue at line 440
Queue setAfterCommitDispatcher(Closure|null $dispatcher)

Set the dispatcher for after-commit queue operations.

Queue connection instances are cached on QueueManager; replacing the dispatcher on a shared connection changes every subsequent after-commit enqueue through it.

Parameters

Closure|null $dispatcher

Return Value

Queue

in Queue at line 456
protected mixed enqueueUsing(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay, callable $callback)

Enqueue a job using the given callback.

The callback receives the queue that owns the operation first so deferred pooled dispatch never retains a borrowed queue.

Parameters

object|string $job
string $payload
string|null $queue
DateInterval|DateTimeInterface|int|null $delay
callable $callback

Return Value

mixed

in SyncQueue at line 417
protected void deferEnqueueAfterCommit(DatabaseTransactionsManager $transactions, object|string $job, Closure $enqueue)

Honor the selected transaction without resolving outbox storage services.

Parameters

DatabaseTransactionsManager $transactions
object|string $job
Closure $enqueue

Return Value

void

in Queue at line 509
protected void deferBatchEnqueueAfterCommit(DatabaseTransactionsManager $transactions, array $jobs, Closure $enqueue, string|null $connection = null)

Defer a batch enqueue operation until the applicable transaction commits.

Parameters

DatabaseTransactionsManager $transactions
array $jobs
Closure $enqueue
string|null $connection

Return Value

void

in Queue at line 552
static protected mixed runDeferredEnqueue(array $jobs, Closure $operation)

Run deferred work with its dispatch locks and optional deferredDispatchFailed job hook.

Parameters

array $jobs
Closure $operation

Return Value

mixed

in Queue at line 589
protected mixed enqueueNow(object|string $job, string $payload, string|null $queue, DateInterval|DateTimeInterface|int|null $delay, callable $callback)

Enqueue a job immediately using the given callback.

Parameters

object|string $job
string $payload
string|null $queue
DateInterval|DateTimeInterface|int|null $delay
callable $callback

Return Value

mixed

in Queue at line 631
protected string preparePayloadForPush(object|string $job, string $payload, string|null $queue)

Prepare a finalized payload for storage without changing lifecycle event correlation.

Parameters

object|string $job
string $payload
string|null $queue

Return Value

string

in Queue at line 639
protected void handlePayloadPushed(string $payload, string|null $queue)

Handle a payload after the queue has accepted it.

Parameters

string $payload
string|null $queue

Return Value

void

in Queue at line 656
protected Throwable|null notifyBatchMembers(array $members, Closure ...$notifications)

Notify every batch member and return the first ordinary notification failure.

A canceled notification does not skip the remaining members; the first cancellation is rethrown once every member has been notified, and the ordinary failure it displaces is reported.

Parameters

array $members
Closure ...$notifications

Return Value

Throwable|null

Exceptions

Throwable

in Queue at line 693
protected void notifyBatchMembersOfFailure(array $members, Closure $notification)

Notify every batch member of a failure or cancellation, reporting listener errors so they cannot replace it.

Parameters

array $members
Closure $notification

Return Value

void

in Queue at line 703
protected void reportSecondaryFailure(Throwable $exception)

Report a failure that must not replace the primary error, without swallowing cancellation.

Parameters

Throwable $exception

Return Value

void

in Queue at line 730
protected string finalizePayloadForQueueing(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Finalize an encoded payload immediately before queueing.

Parameters

string|null $queue
object|string $job
string $payload
DateInterval|DateTimeInterface|int|null $delay

Return Value

string

in Queue at line 765
protected array partitionJobsByAfterCommit(array $jobs, DatabaseTransactionsManager|null $transactions)

Partition jobs by whether they should be deferred until the active transaction commits.

Parameters

array $jobs
DatabaseTransactionsManager|null $transactions

Return Value

array

in SyncQueue at line 398
protected bool shouldDispatchAfterCommit(object|string $job)

Degrade selected outbox delivery to local execution after commit.

Parameters

object|string $job

Return Value

bool

in Queue at line 806
protected void addJobRollbackCallback(DatabaseTransactionsManager $transactions, object|string $job, string|null $connection = null)

Register a transaction rollback callback that releases the job's locks.

Parameters

DatabaseTransactionsManager $transactions
object|string $job
string|null $connection

Return Value

void

in Queue at line 818
protected Closure|null createJobRollbackCallback(object|string $job)

Create a callback that releases the job's locks.

Parameters

object|string $job

Return Value

Closure|null

in Queue at line 831
protected void acceptDispatchLocks(object|string $job)

Mark a job's dispatch locks as accepted by the queue.

Parameters

object|string $job

Return Value

void

in Queue at line 843
protected void raiseJobQueueingEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Raise the job queueing event.

Parameters

string|null $queue
object|string $job
string $payload
DateInterval|DateTimeInterface|int|null $delay

Return Value

void

in Queue at line 864
protected void raiseJobQueueingFailedEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay, Throwable $exception, bool $sendAttempted = true)

Raise the job queueing failed event, or the canceled event when cancellation stopped the job.

Parameters

string|null $queue
object|string $job
string $payload
DateInterval|DateTimeInterface|int|null $delay
Throwable $exception
bool $sendAttempted

Return Value

void

in Queue at line 908
protected void raiseJobQueueingCanceledEvent(string|null $queue, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay, Throwable $cancellation, bool $sendAttempted, bool $queued = false, Throwable|null $exception = null)

Raise the job queueing canceled event.

The cancellation is already propagating, so a listener failure is reported instead of replacing it.

Parameters

string|null $queue
object|string $job
string $payload
DateInterval|DateTimeInterface|int|null $delay
Throwable $cancellation
bool $sendAttempted
bool $queued
Throwable|null $exception

Return Value

void

in Queue at line 951
protected void raiseJobQueuedEvent(string|null $queue, mixed $jobId, object|string $job, string $payload, DateInterval|DateTimeInterface|int|null $delay)

Raise the job queued event.

Parameters

string|null $queue
mixed $jobId
object|string $job
string $payload
DateInterval|DateTimeInterface|int|null $delay

Return Value

void

in Queue at line 978
protected string|null normalizeQueue(UnitEnum|string|null $queue)

Normalize an enum queue name without applying defaults or forwarding.

Parameters

UnitEnum|string|null $queue

Return Value

string|null

in Queue at line 986
protected string resolveQueue(string $queue)

Get the routed queue name for the given queue.

Parameters

string $queue

Return Value

string

in Queue at line 1002
string getConnectionName()

Get the connection name for the queue.

Return Value

string

in Queue at line 1016
Queue setConnectionName(string $name)

Set the connection name for the queue.

Queue connection instances are cached on QueueManager; runtime use races across coroutines and changes every concurrent dispatch through this connection.

Parameters

string $name

Return Value

Queue

in Queue at line 1027
array getConfig()

Get the queue configuration array.

Return Value

array

in Queue at line 1041
Queue setConfig(array $config)

Set the queue configuration array.

Queue connection instances are cached on QueueManager; runtime use races across coroutines and changes every concurrent dispatch through this connection.

Parameters

array $config

Return Value

Queue

in Queue at line 1053
Container getContainer()

Get the container instance being used by the connection.

Return Value

Container

in Queue at line 1065
Queue setContainer(Container $container)

Set the IoC container instance.

Queue connection instances are cached on QueueManager; runtime use races across coroutines and changes every concurrent dispatch through this connection.

Parameters

Container $container

Return Value

Queue

in Queue at line 1076
static void flushState()

Flush all static state.

Return Value

void

in CoroutineQueue at line 36
__construct(bool $dispatchAfterCommit = false, Timer|null $timer = null)

Create a new coroutine queue instance.

Parameters

bool $dispatchAfterCommit
Timer|null $timer

in SyncQueue at line 44
int size(UnitEnum|string|null $queue = null)

Get the size of the queue.

Parameters

UnitEnum|string|null $queue

Return Value

int

in SyncQueue at line 52
int pendingSize(UnitEnum|string|null $queue = null)

Get the number of pending jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int

in SyncQueue at line 60
int delayedSize(UnitEnum|string|null $queue = null)

Get the number of delayed jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int

in SyncQueue at line 68
int reservedSize(UnitEnum|string|null $queue = null)

Get the number of reserved jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int

in SyncQueue at line 76
int totalSize()

Get the number of jobs across every queue.

Return Value

int

in SyncQueue at line 84
int totalPendingSize()

Get the number of pending jobs across every queue.

Return Value

int

in SyncQueue at line 92
int totalDelayedSize()

Get the number of delayed jobs across every queue.

Return Value

int

in SyncQueue at line 100
int totalReservedSize()

Get the number of reserved jobs across every queue.

Return Value

int

in SyncQueue at line 108
Collection pendingJobs(UnitEnum|string|null $queue = null)

Get the pending jobs for the given queue.

Parameters

UnitEnum|string|null $queue

Return Value

Collection

in SyncQueue at line 116
Collection delayedJobs(UnitEnum|string|null $queue = null)

Get the delayed jobs for the given queue.

Parameters

UnitEnum|string|null $queue

Return Value

Collection

in SyncQueue at line 124
Collection reservedJobs(UnitEnum|string|null $queue = null)

Get the reserved jobs for the given queue.

Parameters

UnitEnum|string|null $queue

Return Value

Collection

in SyncQueue at line 132
Collection allPendingJobs()

Get all pending jobs across every queue.

Return Value

Collection

in SyncQueue at line 140
Collection allDelayedJobs()

Get all delayed jobs across every queue.

Return Value

Collection

in SyncQueue at line 148
Collection allReservedJobs()

Get all reserved jobs across every queue.

Return Value

Collection

in SyncQueue at line 156
int|null creationTimeOfOldestPendingJob(UnitEnum|string|null $queue = null)

Get the creation timestamp of the oldest pending job, excluding delayed jobs.

Parameters

UnitEnum|string|null $queue

Return Value

int|null

in SyncQueue at line 166
mixed push(object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue.

Parameters

object|string $job
mixed $data
UnitEnum|string|null $queue

Return Value

mixed

Exceptions

Throwable

in SyncQueue at line 203
protected int executeJob(object|string $job, mixed $data = '', string|null $queue = null)

Execute a given job synchronously.

Parameters

object|string $job
mixed $data
string|null $queue

Return Value

int

Exceptions

Throwable

in CoroutineQueue at line 139
protected int executePayload(string $payload, string|null $queue = null)

Schedule a serialized job for coroutine execution.

Parameters

string $payload
string|null $queue

Return Value

int

in SyncQueue at line 236
protected int processPayload(string $payload, string|null $queue = null)

Process a serialized job payload and raise its lifecycle events.

Parameters

string $payload
string|null $queue

Return Value

int

Exceptions

Throwable

in SyncQueue at line 290
protected SyncJob resolveJob(string $payload, string|null $queue)

Resolve a Sync job instance.

Parameters

string $payload
string|null $queue

Return Value

SyncJob

in SyncQueue at line 300
protected void raiseBeforeJobEvent(Job $job)

Raise the before queue job event.

Parameters

Job $job

Return Value

void

in SyncQueue at line 315
protected void raiseAfterJobEvent(Job $job, float|null $duration = null)

Raise the after queue job event.

Parameters

Job $job
float|null $duration

Return Value

void

in SyncQueue at line 330
protected void raiseJobAttemptedEvent(Job $job, Throwable|null $exceptionOccurred = null, float|null $duration = null, bool $canceled = false)

Raise the job attempted event.

Parameters

Job $job
Throwable|null $exceptionOccurred
float|null $duration
bool $canceled

Return Value

void

in SyncQueue at line 345
protected void raiseExceptionOccurredJobEvent(Job $job, Throwable $e)

Raise the exception occurred queue job event.

Parameters

Job $job
Throwable $e

Return Value

void

in SyncQueue at line 362
protected void handleException(Job $queueJob, Throwable $e)

Handle an exception that occurred while processing a job.

Parameters

Job $queueJob
Throwable $e

Return Value

void

Exceptions

Throwable

in SyncQueue at line 374
mixed pushRaw(string $payload, UnitEnum|string|null $queue = null, array $options = [])

Push a raw payload onto the queue.

Parameters

string $payload
UnitEnum|string|null $queue
array $options

Return Value

mixed

in CoroutineQueue at line 47
mixed later(DateInterval|DateTimeInterface|int $delay, object|string $job, mixed $data = '', UnitEnum|string|null $queue = null)

Push a new job onto the queue after (n) seconds.

Parameters

DateInterval|DateTimeInterface|int $delay
object|string $job
mixed $data
UnitEnum|string|null $queue

Return Value

mixed

in SyncQueue at line 430
Job|null pop(UnitEnum|string|null $queue = null)

Pop the next job off of the queue.

Parameters

UnitEnum|string|null $queue

Return Value

Job|null

in CoroutineQueue at line 79
CoroutineQueue setExceptionCallback(callable|null $callback)

Set the exception callback for the coroutine queue.

The callback persists on the cached queue connection for the worker lifetime and handles every subsequent coroutine queue exception.

Parameters

callable|null $callback

Return Value

CoroutineQueue

in CoroutineQueue at line 90
protected int scheduleJob(DateInterval|DateTimeInterface|int $delay, object|string $job, string $payload, string|null $queue)

Schedule a delayed job with its dispatch-time payload.

Parameters

DateInterval|DateTimeInterface|int $delay
object|string $job
string $payload
string|null $queue

Return Value

int

in CoroutineQueue at line 113
protected int scheduleTimer(DateInterval|DateTimeInterface|int $delay, string $payload, string|null $queue, array|null $snapshot)

Schedule the timer that will execute the job after the delay.

Skips execution when the worker is closing — pending delayed jobs are dropped rather than racing against shutdown cleanup. Devs needing durability across worker restarts should use a persistent queue.

Parameters

DateInterval|DateTimeInterface|int $delay
string $payload
string|null $queue
array|null $snapshot

Return Value

int

at line 20
protected void scheduleExecution(Closure $execution)

Defer the given execution callback.

Parameters

Closure $execution

Return Value

void