/** * @inheritdoc */ public function waitForBasicReturn(float $timeout = 0.0) { try { $this->channel->waitForBasicReturn($timeout); } catch (\AMQPChannelException $e) { throw ChannelException::fromAmqpExtension($e); } catch (\AMQPQueueException $e) { throw ChannelException::fromAmqpExtension($e); } }
/** * @inheritdoc */ public function waitForBasicReturn(float $timeout = 0.0) { try { $this->channel->wait(null, false, $timeout); } catch (\Exception $e) { throw ChannelException::fromPhpAmqpLib($e); } }
/** * @inheritdoc */ public function declareQueue() : int { try { return $this->queue->declareQueue(); } catch (\AMQPQueueException $e) { throw QueueException::fromAmqpExtension($e); } catch (\AMQPChannelException $e) { throw ChannelException::fromAmqpExtension($e); } }
/** * @inheritdoc */ public function declareQueue() : int { $args = []; // see: https://github.com/php-amqplib/php-amqplib/issues/405 $supportedDataTypes = AMQPAbstractCollection::getSupportedDataTypes(); foreach ($this->arguments as $k => $v) { if (is_array($v)) { if (empty($v) || array_keys($v) === range(0, count($v) - 1)) { $args[$k] = [$supportedDataTypes[AMQPAbstractCollection::T_ARRAY], new AMQPArray($v)]; } else { $args[$k] = [$supportedDataTypes[AMQPAbstractCollection::T_TABLE], new AMQPTable($v)]; } } elseif (is_int($v)) { $args[$k] = [$supportedDataTypes[AMQPAbstractCollection::T_INT_LONG], $v]; } elseif (is_bool($v)) { $args[$k] = [$supportedDataTypes[AMQPAbstractCollection::T_BOOL], $v]; } elseif (is_string($v)) { $args[$k] = [$supportedDataTypes[AMQPAbstractCollection::T_STRING_LONG], $v]; } else { throw new Exception\InvalidArgumentException('Unknown argument type ' . gettype($v)); } } try { $result = $this->channel->getResource()->queue_declare($this->name, (bool) ($this->flags & Constants::AMQP_PASSIVE), (bool) ($this->flags & Constants::AMQP_DURABLE), (bool) ($this->flags & Constants::AMQP_EXCLUSIVE), (bool) ($this->flags & Constants::AMQP_AUTODELETE), (bool) ($this->flags & Constants::AMQP_NOWAIT), $args, null); } catch (AMQPProtocolChannelException $e) { throw Exception\QueueException::fromPhpAmqpLib($e); } catch (AMQPRuntimeException $e) { throw Exception\ChannelException::fromPhpAmqpLib($e); } $this->name = $result[0]; return $result[1]; }