diff --git a/ZyConsumer.php b/ZyConsumer.php index 5796495..aa6c28b 100644 --- a/ZyConsumer.php +++ b/ZyConsumer.php @@ -49,12 +49,6 @@ public function create($bindKey) } public function pop() - { - $message = static::$queue->get(AMQP_AUTOACK); - return json_decode($message->getBody(), true); - } - - public function popAll() { $rs = []; while ($message = static::$queue->get(AMQP_AUTOACK)) { diff --git a/tests/ZyConsumerTests.php b/tests/ZyConsumerTests.php index 4c65560..1127ccf 100644 --- a/tests/ZyConsumerTests.php +++ b/tests/ZyConsumerTests.php @@ -20,7 +20,7 @@ $zyAmqp->setQueueName('queue_demo'); $zyAmqp->create($bindingkey); -while($message = $zyAmqp->popAll()){ +while($message = $zyAmqp->pop()){ var_dump($message); } diff --git a/tests/ZyProducerTests.php b/tests/ZyProducerTests.php index 37d15f1..c4046f9 100644 --- a/tests/ZyProducerTests.php +++ b/tests/ZyProducerTests.php @@ -19,12 +19,7 @@ $zyAmqp->create(); $message = json_encode(array('Hello World3!', 'php3', 'c++3:')); -$routingkey = 'key'; -for ($i = 0; $i < 100; $i++) { - if ($routingkey == 'key2') { - $routingkey = 'key'; - } else { - $routingkey = 'key2'; - } - $zyAmqp->push($message, $routingkey); -} +$routingkey = 'key2'; + +$zyAmqp->push($message, $routingkey); +