QueueInterface

Type
Interface
Namespace
craft\queue
Implemented by
craft\queue\Queue
Since
3.0.0

QueueInterface defines the common interface to be implemented by queue classes.

View source

Public Methods

MethodDescription
getHasReservedJobs()Returns whether there are any reserved jobs
getHasWaitingJobs()Returns whether there are any waiting jobs
getJobInfo()Returns info about the jobs in the queue.
release()Releases a job from the queue.
retry()Re-adds a failed job to the queue.
run()Runs all the queued-up jobs
setProgress()Sets the progress for the currently reserved job.

getHasReservedJobs()

Returns whether there are any reserved jobs

View source

Returns

boolean

getHasWaitingJobs()

Returns whether there are any waiting jobs

View source

Returns

boolean

getJobInfo()

Returns info about the jobs in the queue. The response array should have sub-arrays with the following keys:

  • id – the job ID
  • status – the job status (1 = waiting, 2 = reserved, 3 = done, 4 = failed)
  • progress – the job progress (0-100)
  • description – the job description
  • error – the error message (if the job failed)

View source

Arguments

Returns

array

release()

Releases a job from the queue.

View source

Arguments

retry()

Re-adds a failed job to the queue.

View source

Arguments

run()

Runs all the queued-up jobs

View source

setProgress()

Sets the progress for the currently reserved job.

View source

Arguments

  • $progress (integer) – The job progress (1-100)
  • $label (string, null) – The progress label