Пример #1
0
 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);
     }
 }