AbstractTaskAdapter
extends AbstractAdapter
in package
implements
TaskAdapterInterface
Adapter abstract class
Tags
Table of Contents
Interfaces
- TaskAdapterInterface
- Adapter interface
Constants
- TASK_CLAIM_TTL = 90
- How long, in seconds, a claim blocks a *same-window* re-claim.
Properties
- $priority : string
- Queue priority
Methods
- __construct() : mixed
- Constructor
- bury() : AdapterInterface
- Move a job to the dead-letter store (terminal)
- claimTaskRun() : bool
- Atomically claim a task's current due-window
- clear() : AdapterInterface
- Clear pending and reserved jobs (not dead-letter jobs)
- clearDead() : AdapterInterface
- clearTasks() : AbstractTaskAdapter
- Clear all scheduled task
- count() : int
- Count of pending + reserved jobs
- countDead() : int
- delete() : AdapterInterface
- Permanently remove a job (success/ack)
- deleteDeadJob() : AdapterInterface
- getAllTasks() : array<string|int, mixed>
- Get every scheduled task, keyed by task ID.
- getDeadJob() : mixed
- getDeadJobs() : array<string|int, mixed>
- getPriority() : string
- getTask() : Task|null
- Get scheduled task
- getTaskCount() : int
- Get scheduled tasks count
- getTasks() : array<string|int, mixed>
- Get scheduled tasks
- hasDeadJobs() : bool
- hasJobs() : bool
- Whether there are pending or reserved jobs
- hasTasks() : bool
- Has scheduled tasks
- isFifo() : bool
- isFilo() : bool
- isLifo() : bool
- isLilo() : bool
- push() : AdapterInterface
- Push a job onto the queue
- release() : AdapterInterface
- Put a reserved job back to pending. $delay overrides the job's own backoff schedule when given; otherwise release() computes the delay from $job->getBackoffDelay().
- removeTask() : AbstractTaskAdapter
- Remove scheduled task
- reserve() : AbstractJob|null
- Atomically claim the next eligible job and lease it. Returns null if nothing is eligible (no pending jobs due, or all reserved jobs have a live lease).
- retryDeadJob() : AdapterInterface
- Move a dead-letter job back to pending
- schedule() : AbstractTaskAdapter
- Schedule job with queue
- setPriority() : AbstractAdapter
- updateTask() : AbstractTaskAdapter
- Update scheduled task
Constants
TASK_CLAIM_TTL
How long, in seconds, a claim blocks a *same-window* re-claim.
protected
mixed
TASK_CLAIM_TTL
= 90
Shared by every concrete adapter's claimTaskRun() implementation. Not configurable - it has no relationship to any task's cron recurrence interval (the explicit window value each implementation compares against is what makes that safe). It does need to outlast the longest window a claim must survive: a claim is never refreshed or released while its task runs, and a coarse (non-sub-minute) task is due across its entire ~60-second window (evaluate() stays true for the whole minute, not just at :00), so a second worker can legitimately re-evaluate the same coarse task's window many seconds after the first worker claimed it. 90 seconds covers a full 60-second coarse window plus slack, not just one claim-then-execute round trip.
Properties
$priority
Queue priority
protected
string
$priority
= 'FIFO'
Methods
__construct()
Constructor
public
__construct([string|null $priority = null ]) : mixed
Parameters
- $priority : string|null = null
bury()
Move a job to the dead-letter store (terminal)
public
abstract bury(AbstractJob $job[, string|null $reason = null ]) : AdapterInterface
Parameters
- $job : AbstractJob
- $reason : string|null = null
Return values
AdapterInterfaceclaimTaskRun()
Atomically claim a task's current due-window
public
abstract claimTaskRun(string $taskId, string $window) : bool
Parameters
- $taskId : string
- $window : string
Return values
boolclear()
Clear pending and reserved jobs (not dead-letter jobs)
public
abstract clear() : AdapterInterface
Return values
AdapterInterfaceclearDead()
public
abstract clearDead() : AdapterInterface
Return values
AdapterInterfaceclearTasks()
Clear all scheduled task
public
abstract clearTasks() : AbstractTaskAdapter
Return values
AbstractTaskAdaptercount()
Count of pending + reserved jobs
public
abstract count() : int
Return values
intcountDead()
public
abstract countDead() : int
Return values
intdelete()
Permanently remove a job (success/ack)
public
abstract delete(AbstractJob $job) : AdapterInterface
Parameters
- $job : AbstractJob
Return values
AdapterInterfacedeleteDeadJob()
public
abstract deleteDeadJob(string $jobId) : AdapterInterface
Parameters
- $jobId : string
Return values
AdapterInterfacegetAllTasks()
Get every scheduled task, keyed by task ID.
public
getAllTasks() : array<string|int, mixed>
Concrete, not abstract, so an adapter only overrides it if its storage can genuinely do better than one fetch per task - which the Database and Redis adapters both can, and do. This fallback is the loop it replaces, kept so that adding the method to TaskAdapterInterface doesn't oblige every adapter to reimplement it.
Return values
array<string|int, mixed> —taskId => Task
getDeadJob()
public
abstract getDeadJob(string $jobId[, bool $unserialize = true ]) : mixed
Parameters
- $jobId : string
- $unserialize : bool = true
getDeadJobs()
public
abstract getDeadJobs([bool $unserialize = true ]) : array<string|int, mixed>
Parameters
- $unserialize : bool = true
Return values
array<string|int, mixed>getPriority()
public
getPriority() : string
Return values
stringgetTask()
Get scheduled task
public
abstract getTask(string $taskId) : Task|null
Parameters
- $taskId : string
Return values
Task|nullgetTaskCount()
Get scheduled tasks count
public
abstract getTaskCount() : int
Return values
intgetTasks()
Get scheduled tasks
public
abstract getTasks() : array<string|int, mixed>
Return values
array<string|int, mixed>hasDeadJobs()
public
abstract hasDeadJobs() : bool
Return values
boolhasJobs()
Whether there are pending or reserved jobs
public
abstract hasJobs() : bool
Return values
boolhasTasks()
Has scheduled tasks
public
abstract hasTasks() : bool
Return values
boolisFifo()
public
isFifo() : bool
Return values
boolisFilo()
public
isFilo() : bool
Return values
boolisLifo()
public
isLifo() : bool
Return values
boolisLilo()
public
isLilo() : bool
Return values
boolpush()
Push a job onto the queue
public
abstract push(AbstractJob $job) : AdapterInterface
Parameters
- $job : AbstractJob
Return values
AdapterInterfacerelease()
Put a reserved job back to pending. $delay overrides the job's own backoff schedule when given; otherwise release() computes the delay from $job->getBackoffDelay().
public
abstract release(AbstractJob $job[, int|null $delay = null ]) : AdapterInterface
Parameters
- $job : AbstractJob
- $delay : int|null = null
Return values
AdapterInterfaceremoveTask()
Remove scheduled task
public
abstract removeTask(string $taskId) : AbstractTaskAdapter
Parameters
- $taskId : string
Return values
AbstractTaskAdapterreserve()
Atomically claim the next eligible job and lease it. Returns null if nothing is eligible (no pending jobs due, or all reserved jobs have a live lease).
public
abstract reserve() : AbstractJob|null
Return values
AbstractJob|nullretryDeadJob()
Move a dead-letter job back to pending
public
abstract retryDeadJob(string $jobId) : AdapterInterface
Parameters
- $jobId : string
Return values
AdapterInterfaceschedule()
Schedule job with queue
public
abstract schedule(Task $task) : AbstractTaskAdapter
Parameters
- $task : Task
Return values
AbstractTaskAdaptersetPriority()
public
setPriority([string $priority = 'FIFO' ]) : AbstractAdapter
Parameters
- $priority : string = 'FIFO'
Return values
AbstractAdapterupdateTask()
Update scheduled task
public
abstract updateTask(Task $task) : AbstractTaskAdapter
Parameters
- $task : Task