Queue
in package
Table of Contents
Constants
- COMPLETED_STATE = 'completed'
- DEFAULT_PIPELINE = 'gx_pipelines'
- FAILED_STATE = 'failed'
- LOCKED_STATE = 'locked'
Methods
- clearJobStatus() : int
- Deletes all job statuses from the cache based on a pipeline name and state.
- getJobStatus() : array<string|int, mixed>
- Gets a list of job UUIDs and their timestamps.
- pop() : Job|bool
- Executes and removes a Job from the pipeline's head.
- processPipeline() : bool|null
- Processes and execute all jobs from a pipeline.
- push() : bool
- Adds a Job or an array of jobs to a pipeline tail in the queue system.
- delState() : mixed
- Removes states from the pipeline|job.
- parsePipelineName() : void
- Parses pipeline name.
- setState() : mixed
- Sets the job state, this could be "Lock" a pipeline to prevent other workers to process it, "completed" or "failed".
Constants
COMPLETED_STATE
public
string
COMPLETED_STATE
= 'completed'
DEFAULT_PIPELINE
public
string
DEFAULT_PIPELINE
= 'gx_pipelines'
FAILED_STATE
public
string
FAILED_STATE
= 'failed'
LOCKED_STATE
public
string
LOCKED_STATE
= 'locked'
Methods
clearJobStatus()
Deletes all job statuses from the cache based on a pipeline name and state.
public
clearJobStatus([string $state = '*' ][, string $pipelineName = '*' ]) : int
Parameters
- $state : string = '*'
- $pipelineName : string = '*'
Return values
intgetJobStatus()
Gets a list of job UUIDs and their timestamps.
public
getJobStatus([string $state = Queue::COMPLETED_STATE ][, string $pipelineName = '*' ]) : array<string|int, mixed>
Parameters
- $state : string = Queue::COMPLETED_STATE
- $pipelineName : string = '*'
Return values
array<string|int, mixed>pop()
Executes and removes a Job from the pipeline's head.
public
pop([string $pipelineName = '*' ]) : Job|bool
Parameters
- $pipelineName : string = '*'
-
Example: "pipeline1"
Tags
Return values
Job|boolprocessPipeline()
Processes and execute all jobs from a pipeline.
public
processPipeline([string $pipelineName = '*' ]) : bool|null
Parameters
- $pipelineName : string = '*'
-
<''> Empty or no value it will process the default pipeline <'all'|'*'> it will process all pipelines
Tags
Return values
bool|nullpush()
Adds a Job or an array of jobs to a pipeline tail in the queue system.
public
push(array<string|int, mixed> $jobs[, string $pipelineName = '*' ]) : bool
Parameters
- $jobs : array<string|int, mixed>
-
Array of Jobs
- $pipelineName : string = '*'
Return values
booldelState()
Removes states from the pipeline|job.
private
delState(string $pipelineName[, string $state = Queue::LOCKED_STATE ]) : mixed
Parameters
- $pipelineName : string
- $state : string = Queue::LOCKED_STATE
parsePipelineName()
Parses pipeline name.
private
parsePipelineName(string &$pipelineName) : void
Parameters
- $pipelineName : string
setState()
Sets the job state, this could be "Lock" a pipeline to prevent other workers to process it, "completed" or "failed".
private
setState(string $pipelineName[, string $state = Queue::LOCKED_STATE ][, int $lockTime = 10 ]) : mixed
Parameters
- $pipelineName : string
- $state : string = Queue::LOCKED_STATE
- $lockTime : int = 10