2017 © Pedro Peláez
 

library yii2-beanstalk-singleton

Trait for only one instance of beanstalk worker

image

fgh151/yii2-beanstalk-singleton

Trait for only one instance of beanstalk worker

  • Friday, June 10, 2016
  • by fgh151
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Yii2 beanstalk singleton trait

Trait for only one instance of beanstalk worker, (*1)

Installation

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

Either run, (*3)

php composer.phar require --prefer-dist fgh151/yii2-beanstalk-singleton "*"

or add, (*4)

"fgh151/yii2-beanstalk-singleton": "*"

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

Usage

Once the extension is installed, add trait to beanstalk controller, (*6)


class TestController extends udokmeci\yii2beanstalk\BeanstalkController { use fgh151\beanstalk\Singleton; }

Now you have additional commands:, (*7)

./yii test/status

it will print pid of current process or "Not active" if worker not run, (*8)

./yii test/halt

it will halt current worker, (*9)

PHP >= 5.4

If you use php >= 5.4, you mas override __construct and __destruct methods:, (*10)

class BuildController extends BeanstalkController
{
    use fgh151\beanstalk\Singleton {
        Singleton::__construct as private __TraitConstruct;
        Singleton::__destruct as private __TraitDestruct;
    }

    public function __construct($id, Module $module, array $config)
    {
        $this->__TraitConstruct($id, $module, $config);
    }

    public function __destruct()
    {
        $this->__TraitDestruct();
    }
}

The Versions

10/06 2016

dev-master

9999999-dev

Trait for only one instance of beanstalk worker

  Sources   Download

MIT

The Requires

 

library yii2 beanstalk singleton

10/06 2016

v0.0.2

0.0.2.0

Trait for only one instance of beanstalk worker

  Sources   Download

MIT

The Requires

 

library yii2 beanstalk singleton

10/06 2016

v0.0.1

0.0.1.0

Trait for only one instance of beanstalk worker

  Sources   Download

MIT

The Requires

 

library yii2 beanstalk singleton