/** * {@inheritdoc} */ public function peek($limit = 1) { if ($limit !== 1) { throw new JobqueueException('The beanstalkd Jobqueue implementation currently only supports to peek one job at a time', 1352717703); } try { $pheanstalkJob = $this->client->peekReady($this->name); } catch (ServerException $exception) { return array(); } if ($pheanstalkJob === null || $pheanstalkJob === false) { return array(); } $message = $this->decodeMessage($pheanstalkJob->getData()); $message->setIdentifier($pheanstalkJob->getId()); $message->setState(Message::STATE_PUBLISHED); return array($message); }