dev-master
9999999-devQueue component for Yii2.
MIT
The Requires
- php ^7.0
- yiisoft/yii2 *
- yiisoft/yii2-redis *
by Igor Ivanoff
extension yii2 queue
Queue component for Yii2.
Simplified php-resque component for Yii2., (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist igoryan-909/yii2-resque "*"
or add, (*4)
"igoryan-909/yii2-resque": "*"
to the require section of your composer.json
file., (*5)
Set config :, (*6)
'controllerMap' => [ 'resque' => [ 'class' => 'ivanoff\resque\controllers\ResqueController', ], ],
Start daemon :, (*7)
php yii resque/listen queue_name
, (*8)
Add job class :, (*9)
class MyJob extends Job { public function setUp() { # Set up environment for this job } public function perform() { # The arguments which given in resque enqueue method are available in $this->args } public function tearDown() { # Remove environment for this job } }
For adding job :, (*10)
$resque = new Resque([ 'redis' => new Connection([ 'hostname' => 'xxx.xxx.xxx.xxx', ]), ]); $token = $resque->enqueue('queue_name', Job::className(), ['arg' => 'val'], true);
For check job status :, (*11)
$status = (new JobStatus([ 'redis' => new Connection([ 'hostname' => 'xxx.xxx.xxx.xxx', ]), 'id' => $token ]))->get();
or get the status from the resque object with its redis :, (*12)
$resque->status($token)->get()
Queue component for Yii2.
MIT
extension yii2 queue