dev-master
9999999-devExtension capable of enqueuing jobs to Resque backend.
BSD-2-Clause
The Requires
by Janaka Wickramasinghe
extension yii2 redis resque
Extension capable of enqueuing jobs to Resque backend.
Extension capable of enqueuing jobs to Resque backend., (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist janakawicks/yii2-resque-enqueue "*"
or add, (*4)
"janakawicks/yii2-resque-enqueue": "*"
to the require section of your composer.json
file., (*5)
To use this extension, you have to configure the yii2-redis Connection class and ResqueEnqueue class in your application configuration:, (*6)
return [ //.... 'components' => [ 'redis' => [ 'class' => 'yii\redis\Connection', 'hostname' => 'localhost', 'port' => 6379, 'database' => 0, ], 'resqueEnqueue' => [ 'class' => 'janakawicks\resque\ResqueEnqueue', ], ] ];
Once the extension is installed, simply use it in your code by :, (*7)
$resqueEnqueue = Yii::$app->resqueEnqueue; $resqueEnqueue->queue = 'mysql_backup'; $resqueEnqueue->enqueue('MySQLBackup', 'mydb01'); // with single argument. $resqueEnqueue->enqueue('MySQLBackup', 'mydb01', true, '2015-12-31'); //with multiple arguments. $resqueEnqueue->enqueue('MySQLBackup', ['mydb01', 'mydb02']); // with single argument with array
You can override the namespace at the configuration or in the code, (*8)
return [ //.... 'components' => [ 'redis' => [ 'class' => 'yii\redis\Connection', 'hostname' => 'localhost', 'port' => 6379, 'database' => 0, ], 'resqueEnqueue' => [ 'class' => 'janakawicks\resque\ResqueEnqueue', 'namespace' => 'my_engine:', ], ] ];
$resqueEnqueue = Yii::$app->resqueEnqueue; $resqueEnqueue->namespace = 'my_engine:';
Key is generated as follows, (*9)
$namespace:queue:$queue_name Example: resque:queue:mysql_backup
Extension capable of enqueuing jobs to Resque backend.
BSD-2-Clause
extension yii2 redis resque