Exemplo n.º 1
0
 /**
  * Process a given job from the queue.
  *
  * @param  \Illuminate\Queue\Jobs\Job  $job
  * @param  int  $delay
  * @return void
  */
 public function process(Job $job, $delay)
 {
     try {
         // First we will fire off the job. Once it is done we will see if it will
         // be auto-deleted after processing and if so we will go ahead and run
         // the delete method on the job. Otherwise we will just keep moving.
         $job->fire();
         if ($job->autoDelete()) {
             $job->delete();
         }
     } catch (\Exception $e) {
         // If we catch an exception, we will attempt to release the job back onto
         // the queue so it is not lost. This will let is be retried at a later
         // time by another listener (or the same one). We will do that here.
         $job->release($delay);
         throw $e;
     }
 }