git submodule add git://github.com/niaeashes/fuel-gearman.git fuel/packages/gearman
add 'gearman'
into always_load.packages
.
- libgearman http://gearman.org
- PECL gearman library http://pecl.php.net/package/gearman
oil r gearman:env
oil refine gearman:worker <class_name>
oil refine gearman:job <function_name> <workload>
Worker_Sample on fuel/app/classes/worker/sample.php
<?php
class Worker_Sample
{
public function work_sample($job)
{
Log::info($job->workload());
}
}
Wakeup sample worker
oil refine gearman:worker Worker_Sample
Do sample job
oil refine gearman:job sample 'This is sample job'
or
<?php
class Controller_Job extends Controller
{
public function action_index()
{
\Gearman\Client::forge('sample', 'This is sample job');
}
}
result (log file)
INFO - 2013-09-08 11:42:27 --> This is sample job