Download the PHP package jetea/queue without Composer
On this page you can find all versions of the php package jetea/queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package queue
queue
A job queue based on beanstalkd(and other queue system), easy to dispatch job and handle job.
Keywords
queue
, job
, easy handle
, job with timeout
, delayed job
, retry_after
, given connection
, given queue
, given tube
, memory limit
,reload
Installation
composer require "jetea/queue:~2.0"
Overview
- Create Queue
- Create Job
- Dispatch Job
- Process Job
- Recommend
- Example
- Todo
Create Queue
Create Job
specifying job queue by defining $queue
, specifying Max Job Attempts by defining $tries
, specifying timeout Values by defining $retry_after
.
Dispatch Job
of cause, you can dispatch job later (push a delayed job) :
Process Job
Note:
$worker->daemon()
is blocking.
by default, the worker will will listen the tube named default
, you can specifying worker queue (beanstalkd tube) like :
you can specifying worker with sleep time while there is no job, and memoryLimit, like :
Notice, if you want reload queue worker, you should implement queueShouldRestart
method on class Jetea\Queue\Worker
.
Recommend
it's highly recommended that extends Jetea\Queue\Worker
, and you should implements these methods: logProcessError
, handleWithObj
, queueShouldRestart
.
Other
the queue package can work on other queue system, you should implements these interface Jetea\Queue\Drivers\Jobs\JobInterface
, Jetea\Queue\Drivers\QueueInterface
.
Example
- https://github.com/Jetea/queue/blob/master/tests/QueueTest.php
- https://github.com/Jetea/app/blob/master/ctx/tests/Ctx/queue_example.php
Link
Todo
- add some useful command, like clearn queue job or kick buried job, etc.