2017 © Pedro PelĂĄez
 

yii2-extension yii2-simple-queue

Yii2 extension to provide SQL based queue worker

image

macklus/yii2-simple-queue

Yii2 extension to provide SQL based queue worker

  • Thursday, April 14, 2016
  • by macklus
  • Repository
  • 2 Watchers
  • 1 Stars
  • 618 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 7 % Grown

The README.md

Yii simple queue worker

Yii2 extension to provide SQL based queue worker, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist macklus/yii2-simple-queue "*"

or add, (*4)

"macklus/yii2-simple-queue": "*"

to the require section of your composer.json file., (*5)

Configuration

Once the extension is installed, configure it define queue component :, (*6)

'queue' => [
  'class' => 'macklus\SimpleQueue\SimpleQueue',
  'connection' => 'db',
  'table' => 'simpleQueue',
  'persistent' => true,
  'duplicate_jobs' => false,
],

Optional vars are:, (*7)

  1. connection: Database connection
  2. table: Name of database table
  3. persistent: If true, no jobs will be delete from database, marked as ENDED as well
  4. duplicate_jobs: Search before insert new job to detect similar one exists

Usage

Once the extension is configured, simply use it to put a job on a queue:, (*8)

Yii::$app->queue->putInTube($queue, [array_of_vars_of_job]);

Controller

You need a controller to get (and process) all jobs. In example:, (*9)

<?php

namespace app\commands;

use macklus\SimpleQueue\SimpleQueueController;

class SqController extends SimpleQueueController
{

    const DELAY_PRIORITY = 1000; //Default priority
    const DELAY_TIME = 60; //Default delay time
    const DELAY_MAX = 3;

    public function listenTubes()
    {
        return ['test'];
    }

    public function actionTest($job)
    {
        $jobData = $job->getData();
        // do some stuff
        return self::DELETE;
    }
}

The Versions

14/04 2016

dev-master

9999999-dev

Yii2 extension to provide SQL based queue worker

  Sources   Download

GPL-3.0+

The Requires

 

by José Pedro Andrés

extension yii2 queue

14/04 2016

1.0.2

1.0.2.0

Yii2 extension to provide SQL based queue worker

  Sources   Download

GPL-3.0+

The Requires

 

by José Pedro Andrés

extension yii2 queue

06/04 2016

1.0.0

1.0.0.0

Yii2 extension to provide SQL based queue worker

  Sources   Download

GPL-3.0+

The Requires

 

by José Pedro Andrés

extension yii2 queue

06/04 2016

1.0.1

1.0.1.0

Yii2 extension to provide SQL based queue worker

  Sources   Download

GPL-3.0+

The Requires

 

by José Pedro Andrés

extension yii2 queue