/** * Handle the failed job. * * @param \Viserio\Contracts\Queue\Job $job */ protected function handleFailedJob(JobContract $job) { $job->failed(); if ($this->container->has('events')) { $this->container->get('events')->trigger('viserio.job.failed', ['connection' => 'sync', 'job' => $job, 'data' => json_decode($job->getRawBody(), true)]); } }
/** * {@inheritdoc} */ public function handleQueuedMessage(JobContract $job, array $data) { $this->send($data['view'], $data['data'], $this->getQueuedCallable($data)); $job->delete(); }
/** * {@inheritdoc} * * @codeCoverageIgnore */ public function release(int $delay = 0) { if ($this->job) { return $this->job->release($delay); } }
/** * Handle an exception that occurred while the job was running. * * @param string $connection * @param \Viserio\Contracts\Queue\Job $job * @param int $delay * @param \Throwable $exception * * @throws \Throwable */ protected function handleJobException(string $connection, JobContract $job, int $delay, Throwable $exception) { // If we catch an exception, we will attempt to release the job back onto the queue // so it is not lost entirely. This'll let the job be retried at a later time by // another listener (or this same one). We will re-throw this exception after. try { if ($this->events !== null) { $this->events->trigger('viserio.job.exception.occurred', ['connection' => $connection, 'job' => $job, 'data' => json_decode($job->getRawBody(), true), 'exception' => $exception]); } } finally { if (!$job->isDeleted()) { $job->release($delay); } } throw $exception; }