使用自定义命令comman/test.php脚本里做消息队列报错是不支持么?

爱吃鱼
[03-Jun-2022 18:51:02 Asia/Shanghai] PHP Fatal error:  Uncaught Error: Call to a member function add() on null in /www/local.lis.com/vendor/workerman/workerman/Connection/AsyncTcpConnection.php:213
Stack trace:
#0 /www/local.lis.com/vendor/workerman/redis/src/Client.php(451): Workerman\Connection\AsyncTcpConnection->connect()
#1 /www/local.lis.com/vendor/workerman/redis/src/Client.php(275): Workerman\Redis\Client->connect()
#2 /www/local.lis.com/vendor/workerman/redis-queue/src/Client.php(73): Workerman\Redis\Client->__construct('redis://redis:6...', Array)
#3 /www/local.lis.com/vendor/webman/redis-queue/src/Client.php(45): Workerman\RedisQueue\Client->__construct('redis://redis:6...', Array)
#4 /www/local.lis.com/vendor/webman/redis-queue/src/Client.php(58): Webman\RedisQueue\Client::connection('default')
#5 /www/local.lis.com/app/command/NatReportCommand.php(66): Webman\RedisQueue\Client::__callStatic('send', Array)
1125 1 0
1个回答

walkor 打赏

Webman\RedisQueue\Client不支持命令行,请升级到composer require webman/redis-queue ^1.2.2或者后续更高版本,然后使用 Webman\RedisQueue\Redis 代替,例如

use Webman\RedisQueue\Redis;

Redis::send($queue, $data);
年代过于久远,无法发表回答
×
🔝