protected function initAmqp() { if ($this->queueDescriptor) { return; } $this->queueDescriptor = new QueueDescriptor(null, false, false, true, true); $this->queueDescriptor->declareQueue($this->getChannel()); }
protected function initAmqp() { if (!$this->declared) { $ed = $this->getExchangeDescriptor(); $ch = $this->getChannel(); $ed->declareExchange($ch); $qd = new QueueDescriptor(); $qd->setAutoDelete(true); $this->setQueueDescriptor($qd); $qd->declareQueue($ch); $ch->queue_bind($qd->getName(), $ed->getName()); $cd = new ConsumerDescriptor(array($this, 'onMessage'), $qd->getName()); $cd->setNoAck(true); $cd->consume($ch); } }