queueyii Simple queue processor extension

QueueYii Extension

Simple queue processor extension for Yii 1.1.*

Requirements
  • PHP 5.3 >
  • Yii 1.1.*
Installation

Download the extension package.

Unzip in extension folder

Add in your config/console.php:

    ...
    'import' => array(
        ...,
        'application.extensions.*',
    ),
    'classMap' => array(
        'queue' => 'application.extensions.queueyii.command.queueCommand
    )
Example Job

Your jobs class should like this:

<?php

/**
 * Class ExampleJob
 */
class ExampleJob extends Job
{
    /**
     * @var string
     */
    private $string;

    public function __construct($string)
    {
        $this->string = $string;
    }

    /**
     * Exec example job
     */
    public function exec()
    {
        // add you code here
        echo "Running job " . $this->string;
    }
}
Adde jobs to queue

You can add a new job on queue with this code:

Jobs::enqueue(new ExampleJob('string');
Running the queue

Using the yiic, you can run the queue, running this command:

php yiic queue listem --delay=5

You can parse the param delay, for add one interval between the jobs. The param delay is not required.

0 0
1 follower
0 downloads
Yii Version: 1.1.*
License: Apache-2.0
Category: Others
Tags:
Developed by: Caio Vinicius
Created on: Aug 15, 2018
Last updated: (not set)
Github Repository