nodesagency/Platform-Common-Plugin — pull request #12 by michaelenger (2012-11-22 16:02:11+00:00)
Title: Add generic GearmanShell console command

This command doesn't do much by itself but is intended to work as a parent
class to another command which will define workers with attached tasks which
implement the workerMethods() method.

```php
class ExampleTask {

/**
* Define the gearman worker methods in the format:
* 'gearmanMethodName' => 'classMethod'
*
* @return array
*/
public function workerMethods() {
return array(
'exampleTask' => 'exampleMethod'
);
}

/**
* Method run when this Gearman-based task is run.
*
* @param GearmanJob $job
*/
public function exampleMethod($job) {
// ...
}
}
```
```php
// Run the example task
GearmanQueue::execute('exampleTask');
```

Any console command which extends this class will have the subcommand "server"
which is used to start the Gearman server.
```bash
Console/cake MyPlugin.MyShellCommand server
```