Call to a member function publish() on null

qq7467466

问题描述

插件名称:【workbunny】RabbitMQ客户端, 服务首次启动调用MQ,异步发送多次任务的时候会报错, 此时控制台只会输出一个信息,再一次请求就不会出问题了

程序代码

        for ($i=1; $i <= 3; $i++){
            async_publish(TestBuilder::instance(), date('Y-m-d H:i:s').'_______'.$i);
        }

报错信息

{
    "code": 0,
    "msg": "Call to a member function publish() on null",
    "data": {
        "request_url": "GET //127.0.0.1:8666/index/mq",
        "timestamp": "2023-02-24 11:17:05",
        "client_ip": "127.0.0.1",
        "request_param": [],
        "error_message": "Call to a member function publish() on null",
        "error_trace": [
            "#0 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workbunny\\webman-rabbitmq\\src\\helpers.php(56): Workbunny\\WebmanRabbitMQ\\Connection->publish()",
            "#1 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\app\\index\\controller\\Index.php(43): Workbunny\\WebmanRabbitMQ\\async_publish()",
            "#2 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\webman-framework\\src\\App.php(318): app\\index\\controller\\Index->mq()",
            "#3 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\webman-framework\\src\\App.php(348): Webman\\App::Webman\\{closure}()",
            "#4 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\webman\\log\\src\\Middleware.php(58): Webman\\App::Webman\\{closure}()",
            "#5 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\webman-framework\\src\\App.php(340): Webman\\Log\\Middleware->process()",
            "#6 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\webman\\cors\\src\\CORS.php(12): Webman\\App::Webman\\{closure}()",
            "#7 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\webman-framework\\src\\App.php(340): Webman\\Cors\\CORS->process()",
            "#8 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\app\\common\\middleware\\RequestMonitoring.php(30): Webman\\App::Webman\\{closure}()",
            "#9 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\webman-framework\\src\\App.php(340): app\\common\\middleware\\RequestMonitoring->process()",
            "#10 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\webman-framework\\src\\App.php(167): Webman\\App::Webman\\{closure}()",
            "#11 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\workerman\\Connection\\TcpConnection.php(646): Webman\\App->onMessage()",
            "#12 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\workerman\\Events\\Select.php(311): Workerman\\Connection\\TcpConnection->baseRead()",
            "#13 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\workerman\\Worker.php(1479): Workerman\\Events\\Select->loop()",
            "#14 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\workerman\\Worker.php(1399): Workerman\\Worker::forkWorkersForWindows()",
            "#15 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\workerman\\Worker.php(560): Workerman\\Worker::forkWorkers()",
            "#16 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workerman\\webman-framework\\src\\support\\App.php(131): Workerman\\Worker::runAll()",
            "#17 D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\start.php(4): support\\App::run()",
            "#18 {main}"
        ],
        "file": "D:\\phpStudy20188\\PHPTutorial\\WWW\\cinemaadmin\\vendor\\workbunny\\webman-rabbitmq\\src\\Connection.php",
        "line": 224
    }
}

操作系统及workerman/webman等框架组件具体版本

Windows:8 CentOS:6.* PHP: 8.0.2 webman-rabbitmq:1.0.9 webman-framework:1.4.3

1040 0 0
0个回答

年代过于久远,无法发表回答
×
🔝