本文整理汇总了PHP中PhpAmqpLib\Connection\AMQPConnection::get_free_channel_id方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPConnection::get_free_channel_id方法的具体用法?PHP AMQPConnection::get_free_channel_id怎么用?PHP AMQPConnection::get_free_channel_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpAmqpLib\Connection\AMQPConnection
的用法示例。
在下文中一共展示了AMQPConnection::get_free_channel_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class constructor
*
* @param Container $container
* @param Configuration $configuration
* @param Channel|null $channel
*/
public function __construct(Container $container, Configuration $configuration, Channel $channel = null)
{
$this->container = $container;
$this->configuration = $configuration;
// Create a new instance of the AMQPConnection object
/** @var \PhpAmqpLib\Connection\AMQPConnection $conn */
$conn = $container->newInstance('PhpAmqpLib\\Connection\\AMQPConnection', array($configuration->getHost(), $configuration->getPort(), $configuration->getUser(), $configuration->getPass()));
// Override the default library properties
$conn::$LIBRARY_PROPERTIES = array('library' => array('S', 'Mopsy PHP Client'), 'library_version' => array('S', '0.1'));
$this->connection = $conn;
if ($channel === null) {
//$this->channel = $this->connection->channel();
$this->channel = $container->newInstance('Mopsy\\Channel', array($this, $this->connection->get_free_channel_id(), true));
} else {
$this->channel = $channel;
}
$this->channels[$this->channel->getChannelId()] = $this->channel;
$this->connection->channels[$this->channel->getChannelId()] = $this->channel;
/** @var Channel\Options queueOptions */
$this->exchangeOptions = $container->newInstance('Mopsy\\Channel\\Options');
/** @var Channel\Options queueOptions */
$this->queueOptions = $container->newInstance('Mopsy\\Channel\\Options');
/*
* Queues will expire after 30 minutes of being unused, meaning it has
* no consumers, has not been redeclared, and basic.get has not been
* invoked.
*
* Messages will be discard from this queue if they haven't been
* acknowledged after 60 seconds.
*/
$this->queueOptions->setArguments(array('x-message-ttl', 60000, 'x-expires' => 1800000));
}