示例#1
0
 /**
  * @param Exchange $exchange
  *
  * @return $this
  */
 public function addExchange(Exchange $exchange)
 {
     if ($this->hasExchange($exchange->name())) {
         throw new \InvalidArgumentException(sprintf('Exchange "%s" already defined', $exchange->name()));
     }
     $this->exchanges[$exchange->name()] = $exchange;
     return $this;
 }
示例#2
0
 /**
  */
 public function initialize()
 {
     if ($this->initialized) {
         return;
     }
     $this->initialized = true;
     $this->exchange->initialize();
     $this->queue->initialize();
     $this->channel->queue_bind($this->queue->name(), $this->exchange->name());
 }