2017 © Pedro Peláez
 

yii2-extension yii2-resque-enqueue

Extension capable of enqueuing jobs to Resque backend.

image

janakawicks/yii2-resque-enqueue

Extension capable of enqueuing jobs to Resque backend.

  • Wednesday, December 28, 2016
  • by janakawicks
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Yii2 Resque Enqueue

Extension capable of enqueuing jobs to Resque backend., (*1)

Installation

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)

Configuration

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',
        ],
    ]
];

Usage

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

Notes

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

The Versions

28/12 2016

dev-master

9999999-dev

Extension capable of enqueuing jobs to Resque backend.

  Sources   Download

BSD-2-Clause

The Requires

 

by Janaka Wickramasinghe

extension yii2 redis resque