windows 环境,想单独启动一个 worker 消费其他项目的redis队列的服务,第一次用 webman, 不知道怎么写
是写一个命令吗,如果是该怎么调 webman/redis-queue 这个插件写好的 consumer
一个worker搞定 如果用webman 看这个 https://www.workerman.net/q/8596
<?php require __DIR__ . '/../../../vendor/autoload.php'; use Workerman\Worker; use Workerman\RedisQueue\Client as QueueClient; $worker = new Worker(); $worker->name = 'QueueWorker'; $worker->count = 8; $worker->onWorkerStart = function () { $apiHost = 'http://www.baidu.com'; $queueClient = new QueueClient('redis://127.0.0.1:6379',['auth' => '123','db' => 0,'retry_seconds' => 2,'max_attempts' => 2]); //物联网 $queueClient->subscribe('iot-queue', function($data){ }); }; Worker::runAll();
https://www.workerman.net/doc/workerman/components/workerman-redis-queue.html 这里有文档
一个worker搞定 如果用webman 看这个 https://www.workerman.net/q/8596
https://www.workerman.net/doc/workerman/components/workerman-redis-queue.html
这里有文档