PHP Enqueue Uncaught Enqueue\Rpc\TimeoutException

问题描述

我遵循了 RPC 命令的文档。 https://php-enqueue.github.io/client/rpc_call/ 实际上页面没有解释如何处理它,所以我不确定这是否正确。当我运行此代码时,出现此错误

致命错误:未捕获的 Enqueue\Rpc\TimeoutException:在未收到回复消息的情况下达到 Rpc 调用超时。

这是一个错误吗?我的代码有问题吗?

<?PHP
require 'vendor/autoload.PHP';

use Enqueue\Consumption\Result;
use Enqueue\SimpleClient\SimpleClient;

$client = new SimpleClient([
    'transport' => [
        'dsn' => 'file://','path' => __DIR__ . DIRECTORY_SEParaTOR . 'tmp',],'client' => [
    ]
]);

$client->setupbroker();

$client->bindCommand('testCommand',static function($message,$context) {
    return Result::reply(
        $context->createMessage('RESPONSE!')
    );
},null);

$reply = $client->sendCommand('testCommand','message data',true);
var_dump($reply->receive(5000)->getBody());

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)