/** * Push the command onto the given queue instance. * * @param \Viserio\Contracts\Queue\QueueConnector $queue * @param mixed $command * * @return mixed */ protected function pushCommandToQueue(QueueContract $queue, $command) { if (isset($command->queue, $command->delay)) { return $queue->laterOn($command->queue, $command->delay, $command); } if (isset($command->queue)) { return $queue->pushOn($command->queue, $command); } if (isset($command->delay)) { return $queue->later($command->delay, $command); } return $queue->push($command); }
/** * Get the next job from the queue connection. * * @param \Viserio\Contracts\Queue\QueueConnector $connection * @param string|null $queue * * @return \Viserio\Contracts\Queue\Job|null */ protected function getNextJob(QueueConnectorContract $connection, string $queue) { if ($queue !== null) { return $connection->pop(); } foreach (explode(',', $queue) as $queue) { if (!is_null($job = $connection->pop($queue))) { return $job; } } }