/** * @param $queue * @param int $timeout * @return void */ public function consume($queue, $timeout = 0) { while (TRUE) { $message = $this->qm->getMessage($queue, $timeout); if ($message !== NULL) { $this->fireCallbacks($message); if ($message->isRequeued()) { $this->qm->publishMessage($queue, $message); } } } }