Download the PHP package jc-it/yii2-job-queue without Composer
On this page you can find all versions of the php package jc-it/yii2-job-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-job-queue
Job Queue for Yii2 (based on Beanstalkd)
This extension provides a package that implements a queue, workers and jobs.
or add
to the require
section of your composer.json
file.
Configuration
- You need to have Beanstalk installed (
sudo apt install beanstalkd
) -
Apply configuration:
-
Register Daemon action in controller:
- Run action, i.e.
./yii job-queue/daemon
Optional: install daemon as service
Look here to see an example how a console action can be installed as a linux service.
Quick test
- Execute steps in Configuration
- Register
\JCIT\jobqueue\jobs\HelloJob::class
and\JCIT\jobqueue\jobHandlers\HelloHandler::class
in theContainerMapLocator
(as shown in the configuration) -
Create
JobQueueController
console controller - Run in one console
src/yii job-queue
- Run in a second console
src/yii job-queue/test
- The console that runs the daemon will show
Hello world
- NOTE the daemon must be restarted when handlers have changed
Own implementations
- Create Job (that implements
\JCIT\jobqueue\interfaces\JobInterface::class
) which should not do more than carry data - Create JobHandler (that implements
\JCIT\jobqueue\interfaces\JobHandlerInterface::class
) which handles the handling of the job- Injection should be done on construction of the handler
Logging
To extend with an easy ActiveRecord logging of the jobs, look at https://packagist.org/packages/jc-it/yii2-job-queue-logging.
Recurring jobs
To extend with easy ActiveRecord based recurring jobs, look at https://packagist.org/packages/jc-it/yii2-job-queue-recurring.
Credits
All versions of yii2-job-queue with dependencies
league/tactician Version ^1.1.0
pda/pheanstalk Version ^4.0.3
yiisoft/yii2 Version ^2.0