-
Notifications
You must be signed in to change notification settings - Fork 26
Queue
李铭昕 edited this page Sep 18, 2017
·
1 revision
编辑app/tasks/TestTask.php
namespace App\Tasks;
use limx\phalcon\Redis;
use limx\phalcon\Cli\Color;
use App\Tasks\System\Queue;
class TestTask extends Queue
{
// 最大进程数
protected $maxProcesses = 10;
// 当前进程数
protected $process = 0;
// 消息队列Redis键值
protected $queueKey = 'phalcon:test:queue';
// 等待时间
protected $waittime = 1;
protected function redisClient()
{
return Redis::getInstance('127.0.0.1', '910123');
}
protected function redisChildClient()
{
return Redis::getInstance('127.0.0.1', '910123', 0, 6379, uniqid());
}
/**
* @desc 消息队列处理逻辑
* @author limx
* @param $data
*/
protected function handle($data)
{
echo Color::success($data);
}
}
运行php run test即可启动消息队列
php run test