/** {@inheritDoc} */ public function getProducer(Gate $gate) { $name = $gate->getName(); $connection = $gate->getConnection()->getName(); if (!isset($this->producers[$connection])) { $this->producers[$connection] = []; } if (!isset($this->producers[$connection][$name])) { $this->producers[$connection][$name] = new PhpAmqpLibMessagePublisher($this->getChannel($gate->getConnection()), $gate->getExchange()); } return $this->producers[$connection][$name]; }
/** {@inheritDoc} */ public function createTemporaryQueue(Gate $gate) { $id = sha1(uniqid(mt_rand(), true)); $key = $gate->getRoutingKey(); $extras = $gate->getExtras(); // creating temporary gate $gate = new Gate($gate->getConnection(), $id, $gate->getExchange(), $id); $gate->setRoutingKey($key)->setExtras($extras); // creating temporary queue $queue = new AMQPQueue($this->getChannel($gate->getConnection())); $queue->setName($id); $queue->setFlags(\AMQP_EXCLUSIVE); $queue->declareQueue(); $queue->bind($gate->getExchange(), $queue->getName()); $this->providers[$gate->getConnection()->getName()][$gate->getName()] = new PeclPackageMessageProvider($queue); return $gate; }
/** Add a Gate within this Bag */ public function add(Gate $gate) { $this->gates[$gate->getName()] = $gate; }