2017 © Pedro Peláez
 

silverstripe-module gearman

A simple integration with the gearmand job processor

image

silverstripe-australia/gearman

A simple integration with the gearmand job processor

  • Wednesday, January 13, 2016
  • by nyeholt
  • Repository
  • 2 Watchers
  • 5 Stars
  • 7,388 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 4 Open issues
  • 5 Versions
  • 9 % Grown

The README.md

SilverStripe Gearman module

Adds a basic level of support for the gearmand php job queue, (*1)

Installation

  • Install gearmand
  • Change its config to use a persistent queue; something like
  PARAMS="--listen=127.0.0.1 -q libsqlite3 --libsqlite3-db /var/run/gearmandb"
  • This uses the Net_Gearman library from publero/net_gearman for communicating with gearman; composer should manage this for you

To test the installation is correct, there's a test job you can execute, (*2)

  • Open two terminal windows in the SS root directory
  • In the first, run php gearman/gearman_runner.php
  • In the second, run php gearman/gearman_test_client.php
  • You should see some information output to the first console window, indicating the job was picked up and processed as expected.

Usage

  • Define a class that implements GearmanHandler
  • The 'getName' method should return the name of a method on the class that will handle the processing of the job (exampleMethod)
  • Start a worker by calling php gearman/gearman_runner.php
  • Trigger the job by calling $this->gearmanService->exampleMethod();
  • Any params passed through to exampleMethod are passed on to the worker
  • Note: This only supports 'background' jobs at the moment, so there are NO return values

Reflected worker

The 'gearman_runner' script is bound to a single instance of SilverStripe; this means that any job spawned against the gearman server is handled and executed by that instance of SilverStripe. In situations where you have multiple instances of SS running, you will need to use the reflected_runner.php script instead of gearman_runner.php. This handler will include the path of the SS instance that triggered the gearman job to be executed, and will spawn a separate process to execute that gearman job within, (*3)

The Versions

13/01 2016

dev-master

9999999-dev

A simple integration with the gearmand job processor

  Sources   Download

BSD-3-Clause

The Requires

 

jobs silverstripe gearman queuedjobs

14/05 2015

1.1.x-dev

1.1.9999999.9999999-dev

A simple integration with the gearmand job processor

  Sources   Download

BSD-3-Clause

The Requires

 

jobs silverstripe gearman queuedjobs

01/05 2015

1.1.0

1.1.0.0

A simple integration with the gearmand job processor

  Sources   Download

BSD-3-Clause

The Requires

 

jobs silverstripe gearman queuedjobs

19/03 2015

1.0.x-dev

1.0.9999999.9999999-dev

A simple integration with the gearmand job processor

  Sources   Download

BSD-3-Clause

The Requires

 

jobs silverstripe gearman queuedjobs

19/03 2015

dev-composer_deps

dev-composer_deps

A simple integration with the gearmand job processor

  Sources   Download

BSD-3-Clause

The Requires

 

jobs silverstripe gearman queuedjobs