/** {@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; }
/** {@inheritDoc} */ public function createTemporaryQueue(Gate $gate) { $key = $gate->getRoutingKey(); $extras = $gate->getExtras(); $name = sha1(uniqid(mt_rand(), true)); $connection = $gate->getConnection()->getName(); // creating temporary gate $gate = new Gate($gate->getConnection(), $name, $gate->getExchange(), $name); $gate->setRoutingKey($key)->setExtras($extras); // creating temporary queuei if (!isset($this->providers[$connection])) { $this->providers[$connection] = []; } $channel = $this->getChannel($gate->getConnection()); $channel->queue_declare($name, false, false, true, false); $channel->queue_bind($gate->getQueue(), $gate->getExchange(), $gate->getQueue()); $this->providers[$connection][$name] = new PhpAmqpLibMessageProvider($this->getChannel($gate->getConnection()), $gate->getQueue()); return $gate; }
/** Add a Gate within this Bag */ public function add(Gate $gate) { $this->gates[$gate->getName()] = $gate; }