/** * @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; }
/** */ 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()); }