微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHP Enqueue Uncaught Enqueue\Rpc\TimeoutException

如何解决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 举报,一经查实,本站将立刻删除。