php-amqplib包中PhpAmqpLib\Channel\AMQPChannel,$ticket变量是什么作用

user_xP0U4yVp
  • 16

https://github.com/php-amqpli...

/**
     * Declares queue, creates if needed
     *
     * @param string $queue
     * @param bool $passive
     * @param bool $durable
     * @param bool $exclusive
     * @param bool $auto_delete
     * @param bool $nowait
     * @param array|AMQPTable $arguments
     * @param int|null $ticket
     * @return array|null
     *@throws \PhpAmqpLib\Exception\AMQPTimeoutException if the specified operation timeout was exceeded
     */
    public function queue_declare(
        $queue = '',
        $passive = false,
        $durable = false,
        $exclusive = false,
        $auto_delete = true,
        $nowait = false,
        $arguments = array(),
        $ticket = null
    )
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();

// 参数 $ticket 最后一个,请问它的作用是什么
$channel->queue_declare(queue:'hello', passive:false, durable:false, exclusive:false, auto_delete:false, nowait:flase, arguments:false, ticket:null);

$msg = new AMQPMessage('Hello World!');
$channel->basic_publish($msg, '', 'hello');

echo " [x] Sent 'Hello World!'\n";

$channel->close();
$connection->close();

namespace PhpAmqpLib\Channel; class AMQPChannel.
方法:queue_declare($ticket = null),queue_bind,exchange_declare,exchange_unbind等这些方法都有参数$ticket,请问$ticket的作用是什么

回复
阅读 316
1 个回答
✓ 已被采纳
你知道吗?

宣传栏