02/10
2016
A remote client based on Guzzle 6
A multi-processes worker framework based on Swoole and Gearman, (*1)
Install swoole
and gearman
first., (*2)
Quick start, (*3)
$worker = new \baohan\SwooleGearman\Queue\Worker(); $worker->addCallback('user::created'); $worker->addCallback('user::updated'); $router = new \baohan\SwooleGearman\Router(); $router->setPrefix("\\App\\Job\\"); $router->setExecutor("execute"); $router->setDecode(function($payload) { return \json_decode($payload, true); }); $worker->addRouter($router); $serv = new \baohan\SwooleGearman\Server($worker); $serv->setSwoolePort(9505); // custom callback event $serv->setEvtStart(function($serv) { echo "server start!" . PHP_EOL; }); $serv->start();
Event callbacks, (*4)