Esempio n. 1
0
 /** {@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];
 }
Esempio n. 2
0
 /** {@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;
 }
Esempio n. 3
0
 /** Add a Gate within this Bag */
 public function add(Gate $gate)
 {
     $this->gates[$gate->getName()] = $gate;
 }