Permalink
Browse files

Fixed consumers leak

  • Loading branch information...
remco
remco committed May 21, 2015
1 parent 5269d59 commit 0b73af00714ed7da502d96e99ea1f7d0b386597d
Showing with 3 additions and 3 deletions.
  1. +3 −3 RabbitMq/RpcClient.php
View
@@ -44,13 +44,13 @@ public function addRequest($msgBody, $server, $requestId = null, $routingKey = '
public function getReplies()
{
$this->replies = array();
$this->getChannel()->basic_consume($this->getQueueName(), '', false, true, false, false, array($this, 'processMessage'));
$consumer_tag = $this->getChannel()->basic_consume($this->getQueueName(), '', false, true, false, false, array($this, 'processMessage'));
while (count($this->replies) < $this->requests) {
$this->getChannel()->wait(null, false, $this->timeout);
}
$this->getChannel()->basic_cancel($this->getQueueName());
$this->getChannel()->basic_cancel($consumer_tag);
$this->requests = 0;
$this->timeout = 0;
@@ -70,7 +70,7 @@ public function processMessage(AMQPMessage $msg)
protected function getQueueName()
{
if (null === $this->queueName) {
list($this->queueName, ,) = $this->getChannel()->queue_declare("", false, false, true, true);
list($this->queueName, ,) = $this->getChannel()->queue_declare("", false, false, true, false);
}
return $this->queueName;

0 comments on commit 0b73af0

Please sign in to comment.