예제 #1
0
 /**
  * Run queue on deleting a model.
  *
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @param  array  $data
  *
  * @return void
  */
 public function fire(Job $job, array $data)
 {
     $database = Arr::get($data, 'database');
     $migrator = $this->resolveMigrator($data);
     $entity = $this->resolveModelEntity($migrator, $data);
     if (is_null($entity)) {
         $job->delete();
         return;
     }
     $migrator->runReset($entity, $database);
     $job->delete();
 }
예제 #2
0
 /**
  * Handle the queued job.
  *
  * @param  \Illuminate\Contracts\Queue\Job $job
  * @param  array $data
  * @return void
  */
 public function fire(Job $job, array $data)
 {
     $event = unserialize($data['event']);
     $name = method_exists($event, 'broadcastAs') ? $event->broadcastAs() : get_class($event);
     $this->broadcaster->broadcast($event->broadcastOn(), $name, $this->getPayloadFromEvent($event));
     $job->delete();
 }
예제 #3
0
 public function fire(Job $job, $data)
 {
     if ($job->attempts() > 2) {
         $job->delete();
     }
     $this->factory->getProject($data['project'])->githubSync()->syncAll();
 }
예제 #4
0
 /**
  * @param \Illuminate\Contracts\Queue\Job $job
  * @param array $data
  * @return mixed
  */
 public function fire($job, array $data)
 {
     $id = $data[0];
     $task = $this->serializer->unserialize($data[1]);
     $response = call_user_func($task);
     $job->delete();
     $this->publisher->publish("kyew:task:{$id}", $response);
 }
예제 #5
0
 public function fire(Job $job, $data)
 {
     $this->codex->log('alert', 'codex.hooks.git.sync.project.command', ['jobName' => $job->getName(), 'jobAttempts' => $job->attempts(), 'project' => $data['project']]);
     if ($job->attempts() > 2) {
         $job->delete();
     }
     $this->codex->getProject($data['project'])->gitSyncer()->syncAll();
 }
 /**
  * Handle a queued push notification message job.
  * 
  * @param \Illuminate\Contracts\Queue\Job  $job
  * @param DeveloperDynamo\PushNotification\Payload\AbstractPayload $payload
  * @param array<DeveloperDynamo\PushNotification\Token> $tokens
  * @return void
  */
 public function handleQueuedSending($job, $data)
 {
     //Unserialize data
     $payload = unserialize($data['payload']);
     $tokens = unserialize($data['tokens']);
     //Execute task
     $this->send($payload, $tokens);
     //Delete job from the queue
     $job->delete();
 }
예제 #7
0
 /**
  * Log a failed job into storage.
  *
  * @param  string  $connection
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @return array
  */
 protected function logFailedJob($connection, Job $job)
 {
     if ($this->failer) {
         $this->failer->log($connection, $job->getQueue(), $job->getRawBody());
         $job->delete();
         $this->raiseFailedJobEvent($connection, $job);
     }
     return ['job' => $job, 'failed' => true];
 }
예제 #8
0
 /**
  * Mark the given job as failed and raise the relevant event.
  *
  * @param  string  $connectionName
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @param  \Exception  $e
  * @return void
  */
 protected function failJob($connectionName, $job, $e)
 {
     if ($job->isDeleted()) {
         return;
     }
     try {
         // If the job has failed, we will delete it, call the "failed" method and then call
         // an event indicating the job has failed so it can be logged if needed. This is
         // to allow every developer to better keep monitor of their failed queue jobs.
         $job->delete();
         $job->failed($e);
     } finally {
         $this->raiseFailedJobEvent($connectionName, $job, $e);
     }
 }
예제 #9
0
 /**
  * Delete the job from the queue.
  *
  * @return void
  */
 public function delete()
 {
     if ($this->job) {
         return $this->job->delete();
     }
 }
예제 #10
0
 /**
  * Handle a queued e-mail message job.
  *
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @param  array  $data
  * @return void
  */
 public function handleQueuedMessage($job, $data)
 {
     $this->send($data['view'], $data['data'], $this->getQueuedCallable($data));
     $job->delete();
 }
예제 #11
0
 /**
  * Mark the given job as failed if it has exceeded the maximum allowed attempts.
  *
  * @param  string  $connectionName
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @param  int  $maxTries
  * @param  \Exception  $e
  * @return void
  */
 protected function markJobAsFailedIfHasExceededMaxAttempts($connectionName, $job, $maxTries, $e)
 {
     if ($maxTries === 0 || $job->attempts() < $maxTries) {
         return;
     }
     // If the job has failed, we will delete it, call the "failed" method and then call
     // an event indicating the job has failed so it can be logged if needed. This is
     // to allow every developer to better keep monitor of their failed queue jobs.
     $job->delete();
     $job->failed($e);
     $this->raiseFailedJobEvent($connectionName, $job, $e);
 }
예제 #12
0
파일: SMS.php 프로젝트: adetoola/sms
 /**
  * Handle a queued e-mail message job.
  *
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @param  array  $data
  * @return void
  */
 public function handleQueuedMessage($job, $data)
 {
     $this->send($data['recepient'], $data['message'], $data['sender'], $data['message_type']);
     $job->delete();
 }
예제 #13
0
 /**
  * Handle a queued message job.
  *
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @param  array  $data
  *
  * @return void
  */
 public function handleQueuedMessage(Job $job, $data)
 {
     $this->send($this->getQueuedCallable($data));
     $job->delete();
 }
예제 #14
0
 /**
  * Handle the queued job.
  *
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @param  array  $data
  * @return void
  */
 public function fire(Job $job, array $data)
 {
     call_user_func_array([$this->container->make($data['class']), $data['method']], $data['data']);
     $job->delete();
 }
예제 #15
0
 /**
  * Log a failed job into storage.
  *
  * @param  string  $connection
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @return void
  */
 protected function logFailedJob($connection, Job $job)
 {
     if (!$this->failer) {
         return;
     }
     $failedId = $this->failer->log($connection, $job->getQueue(), $job->getRawBody());
     $job->delete();
     $job->failed();
     $this->raiseFailedJobEvent($connection, $job, $failedId);
 }
예제 #16
0
 /**
  * fire.
  *
  * @author Casper Rasmussen <*****@*****.**>
  *
  * @param \Illuminate\Contracts\Queue\Job $job
  * @param                                 $queuName
  *
  * @return void
  */
 public function fire(Job $job, $queueName)
 {
     (new Client())->patch('https://nstack.io/api/queues/monitors/' . $queueName);
     $job->delete();
 }