QueueManager
in package
implements
QueueInterface
Queue manager
Table of Contents
Interfaces
- QueueInterface
- Queue interface
Properties
- $driver : QueueStorageInterface|object
- Queue storage driver
- $jobsRegistry : object|null
- Jobs registry
- $logger : LoggerInterface|null
- Logger
Methods
- __construct() : mixed
- Constructor
- addJob() : bool
- Add job to queue
- clear() : bool
- Delete all jobs
- create() : JobInterface|null
- Create job obj
- createFromStorage() : JobInterface|null
- Create job instance from file in storage path
- createJobFromArray() : JobInterface|null
- Create job intence from array
- createWorkerManager() : WorkerManagerInterface|null
- Create worker manager
- deleteJob() : bool
- Delete job
- deleteJobs() : bool
- Delete jobs
- executeJob() : JobInterface|null
- Execute job
- getJob() : array<string|int, mixed>|null
- Find job by name, id or uuid
- getJobs() : array<string|int, mixed>|null
- Get jobs
- getJobsDue() : array<string|int, mixed>|null
- Get all jobs due
- getNext() : JobInterface|null
- Get next job
- getRecuringJobs() : array<string|int, mixed>|null
- Get recurring jobs
- getStorageDriver() : QueueStorageInterface
- Get queue storage driver
- has() : bool
- Return tru if job exist
- jobsRegistry() : object
- Get jobs registry
- push() : bool
- Push job to queue
- run() : JobInterface|null
- Run job
- setDriver() : void
- Set queue storage driver
- updateJobParam() : bool
- Update job config param
Properties
$driver
Queue storage driver
protected
QueueStorageInterface|object
$driver
$jobsRegistry
Jobs registry
protected
object|null
$jobsRegistry
$logger
Logger
protected
LoggerInterface|null
$logger
Methods
__construct()
Constructor
public
__construct(QueueStorageInterface $driver[, LoggerInterface|null $logger = null ]) : mixed
Parameters
- $driver : QueueStorageInterface
- $logger : LoggerInterface|null = null
addJob()
Add job to queue
public
addJob(JobInterface $job[, string|null $extension = null ][, bool $disabled = false ][, string|null $recuringInterval = null ][, int|null $scheduleTime = null ][, array<string|int, mixed>|null $config = null ]) : bool
Parameters
- $job : JobInterface
- $extension : string|null = null
- $disabled : bool = false
- $recuringInterval : string|null = null
- $scheduleTime : int|null = null
- $config : array<string|int, mixed>|null = null
Return values
boolclear()
Delete all jobs
public
clear() : bool
Return values
boolcreate()
Create job obj
public
create(string $class[, array<string|int, mixed>|null $params = null ][, string|null $extension = null ]) : JobInterface|null
Parameters
- $class : string
-
job class or name
- $params : array<string|int, mixed>|null = null
- $extension : string|null = null
Return values
JobInterface|nullcreateFromStorage()
Create job instance from file in storage path
public
createFromStorage(string $storagePath[, string|null $className = null ][, array<string|int, mixed> $params = [] ]) : JobInterface|null
Parameters
- $storagePath : string
- $className : string|null = null
- $params : array<string|int, mixed> = []
Return values
JobInterface|nullcreateJobFromArray()
Create job intence from array
public
createJobFromArray(array<string|int, mixed> $data) : JobInterface|null
Parameters
- $data : array<string|int, mixed>
Return values
JobInterface|nullcreateWorkerManager()
Create worker manager
public
createWorkerManager([string|null $name = null ][, array<string|int, mixed>|null $args = null ]) : WorkerManagerInterface|null
Parameters
- $name : string|null = null
- $args : array<string|int, mixed>|null = null
Return values
WorkerManagerInterface|nulldeleteJob()
Delete job
public
deleteJob(string|int $id) : bool
Parameters
- $id : string|int
-
Job id, uiid
Return values
booldeleteJobs()
Delete jobs
public
deleteJobs([array<string|int, mixed> $filter = [] ]) : bool
Parameters
- $filter : array<string|int, mixed> = []
Return values
boolexecuteJob()
Execute job
public
executeJob(JobInterface $job[, Closure|null $onJobProgress = null ][, Closure|null $onJobProgressError = null ]) : JobInterface|null
Parameters
- $job : JobInterface
- $onJobProgress : Closure|null = null
- $onJobProgressError : Closure|null = null
Return values
JobInterface|nullgetJob()
Find job by name, id or uuid
public
getJob(string|int $id) : array<string|int, mixed>|null
Parameters
- $id : string|int
-
Job id, uiid or name
Return values
array<string|int, mixed>|nullgetJobs()
Get jobs
public
getJobs([array<string|int, mixed> $filter = [] ]) : array<string|int, mixed>|null
Parameters
- $filter : array<string|int, mixed> = []
Return values
array<string|int, mixed>|nullgetJobsDue()
Get all jobs due
public
getJobsDue([string|null $jobName = null ]) : array<string|int, mixed>|null
Parameters
- $jobName : string|null = null
Return values
array<string|int, mixed>|nullgetNext()
Get next job
public
getNext() : JobInterface|null
Return values
JobInterface|nullgetRecuringJobs()
Get recurring jobs
public
getRecuringJobs([string|null $extension = null ]) : array<string|int, mixed>|null
Parameters
- $extension : string|null = null
Return values
array<string|int, mixed>|nullgetStorageDriver()
Get queue storage driver
public
getStorageDriver() : QueueStorageInterface
Return values
QueueStorageInterfacehas()
Return tru if job exist
public
has(mixed $id) : bool
Parameters
- $id : mixed
Return values
booljobsRegistry()
Get jobs registry
public
jobsRegistry() : object
Return values
objectpush()
Push job to queue
public
push(string $name[, array<string|int, mixed>|null $params = null ][, string|null $extension = null ][, string|null $recuringInterval = null ][, string|null $scheduleTime = null ]) : bool
Parameters
- $name : string
-
job name or class
- $params : array<string|int, mixed>|null = null
- $extension : string|null = null
-
Extension package name
- $recuringInterval : string|null = null
- $scheduleTime : string|null = null
Return values
boolrun()
Run job
public
run(JobInterface|string $name[, array<string|int, mixed>|null $params = null ][, string|null $extension = null ][, Closure|null $onJobProgress = null ][, Closure|null $onJobProgressError = null ]) : JobInterface|null
Parameters
- $name : JobInterface|string
-
Job class, name or job instance
- $params : array<string|int, mixed>|null = null
-
job params
- $extension : string|null = null
-
package extension name
- $onJobProgress : Closure|null = null
- $onJobProgressError : Closure|null = null
Return values
JobInterface|nullsetDriver()
Set queue storage driver
public
setDriver(QueueStorageInterface $driver) : void
Parameters
- $driver : QueueStorageInterface
updateJobParam()
Update job config param
public
updateJobParam(string $id, string $key, mixed $value) : bool
Parameters
- $id : string
-
Job id
- $key : string
- $value : mixed