Skip to content
A basic integration with gearmand
Branch: master
Clone or download
Latest commit 3b0e299 Jan 13, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
_config FIX Swapped to using _config/ instead of an empty config.php May 1, 2015
code Converted to PSR-2 Dec 17, 2015
.editorconfig Added standard .editorconfig file Dec 31, 2015 DOC readme update May 1, 2015
composer.json Merge branch 'composer_deps' Mar 19, 2015
gearman_runner.php FIX Change from gearman_handle to more specific silverstripe_handle May 1, 2015

SilverStripe Gearman module

Adds a basic level of support for the gearmand php job queue


  • Install gearmand
  • Change its config to use a persistent queue; something like
  PARAMS="--listen= -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

  • 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.


  • 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

You can’t perform that action at this time.