baohan/swoole-job

A multi-processes worker framework based on Swoole

1.0.2 2016-08-29 07:32 UTC

This package is auto-updated.

Last update: 2024-04-29 03:24:09 UTC


README

A job dispatcher based on swoole

Install

Install swoole first.

composer update baohan/swoole-job

How

Quick start

$router = new \baohan\SwooleJob\Router();
$router->setPrefix("\\App\\Job\\");
$router->setExecutor("execute");
$router->setDecode(function($data) {
    return json_decode($data, true);
});

$serv = new \baohan\SwooleJob\Server($router);
$serv->setSwoolePort(9505);
// custom callback event
$serv->setEvtStart(function($serv) {
    echo "server start!" . PHP_EOL;
});
$serv->start();

Configure

Event callbacks