Beispiel #1
0
 /**
  * Create this queue.
  *
  * @recoil-coroutine
  *
  * @param Channel|null $channel The application-managed channel to use (null = auto-managed).
  *
  * @return tuple<int,int>          A 2-tuple containing the queue's current message and consumer count.
  * @throws ResourceLockedException Another connection has exclusive access to the queue.
  * @throws DeclareException        The queue already exists with different options.
  * @throws ConnectionException     The connection is closed.
  * @throws ChannelException        The channel is closed.
  */
 public function create(Channel $channel = null) : Generator
 {
     try {
         return (yield $this->declareQueue(false, $channel));
     } catch (AmqpException $e) {
         if ($e->getCode() === Constants::PRECONDITION_FAILED) {
             throw DeclareException::queueOptionMismatch($this->name, $this->options, $e);
         }
         throw $e;
     }
 }