yii-resque php-resque wrapper for Yii, build as component and command console

Yii Resque

  1. Requirement
  2. Configuration
  3. How to
  4. Project Resource

Yii resque is a component for Yii to queue your background jobs, this component based on php-resque with some enhancement for support phpredis.

Requirement

  • php pnctl extension.
  • Redis.io
  • phpredis extension for better performance, otherwise it'll automatically using Credis as fallback.
  • Yii Framework >1.1.x

Configuration

  • Copy files to each folder
  • Add to your `config.phpand yourconsole.php`
...
    'components'=>array(
        ...
        'resque'=>array(
            'class' => 'application.components.yii-resque.RResque',
            'server' => 'localhost',    // Redis server address
            'port' => '6379',           // Redis server port
            'database' => 0             // Redis database number
        ),
        ...
    )
    ...
  • Change path for Yii framework folder in `components/yii-resque/bin/resque`

How to

Create job and Workers

You can put this line where ever you want to register the queue

Yii::app()->resque->createJob('queue_name', 'Worker_ClassWorker', $args = array());

Put your workers inside Worker folder and name the class with `Worker_as prefix, e.g you want to create worker with name SendEmail then you can create file inside Worker folder and name it SendEmail.php, class inside this file must beWorker_SendEmail`

Start and Stop workers

Run this command from your console/terminal :

    yiic rresque start

or

    yiic rresque stop

Project Resource

3 0
11 followers
0 downloads
Yii Version: 1.1
License: MIT
Category: Web Service
Developed by: TheBee
Created on: Apr 17, 2013
Last updated: 11 years ago

Related Extensions