QueueInterface

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

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

A class implementing this interface should also use \craft\queue\SavableComponentTrait and \craft\queue\JobTrait.

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

Signature

public abstract boolean getHasReservedJobs ( )

getHasWaitingJobs()

Returns whether there are any waiting jobs

View source

Returns

boolean

Signature

public abstract boolean getHasWaitingJobs ( )

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

Signature

public abstract array getJobInfo ( \craft\queue\int $limit = null )

release()

Releases a job from the queue.

View source

Arguments

Signature

public abstract void release ( \craft\queue\string $id )

retry()

Re-adds a failed job to the queue.

View source

Arguments

Signature

public abstract void retry ( \craft\queue\string $id )

run()

Runs all the queued-up jobs

View source

Signature

public abstract void run ( )

setProgress()

Sets the progress for the currently reserved job.

View source

Arguments

  • $progress (integer) – The job progress (1-100)

Signature

public abstract void setProgress ( \craft\queue\int $progress )