當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Queue\Job類代碼示例

本文整理匯總了PHP中Illuminate\Contracts\Queue\Job的典型用法代碼示例。如果您正苦於以下問題:PHP Job類的具體用法?PHP Job怎麽用?PHP Job使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Job類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fire

 public function fire(Job $job, $data)
 {
     if ($job->attempts() > 2) {
         $job->delete();
     }
     $this->factory->getProject($data['project'])->githubSync()->syncAll();
 }
開發者ID:docit,項目名稱:github-hook,代碼行數:7,代碼來源:GithubSyncProject.php

示例2: raiseFailedJobEvent

 /**
  * Raise the failed queue job event.
  *
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @return void
  */
 protected function raiseFailedJobEvent(Job $job)
 {
     $data = json_decode($job->getRawBody(), true);
     if ($this->container->bound('events')) {
         $this->container['events']->fire('illuminate.queue.failed', array('sync', $job, $data));
     }
 }
開發者ID:betes-curieuses-design,項目名稱:ElieJosiePhotographie,代碼行數:13,代碼來源:SyncQueue.php

示例3: fire

 /**
  * 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();
 }
開發者ID:scrobot,項目名稱:Lumen,代碼行數:14,代碼來源:BroadcastEvent.php

示例4: process

 public function process($connection, Job $job, $maxTries = 0, $delay = 0)
 {
     if ($maxTries > 0 && $job->attempts() > $maxTries) {
         return $this->logFailedJob($connection, $job);
     }
     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();
         return ['job' => $job, 'failed' => false];
     } 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.
         if (!$job->isDeleted()) {
             // Add exponential delay based on the job attempts and the provided delay seconds.
             // The delay will default to 30 seconds by default or when delay is set to zero.
             // A max delay of 2 hours will be used when exponential delay exceeds 2 hours
             // Example of delay in seconds: 30, 60, 90, 180, ... 7200
             $delay = $delay ?: 30;
             $delay = $job->attempts() > 1 ? pow(2, $job->attempts() - 2) * $delay : 0;
             $maxDelay = 60 * 60 * 2;
             if ($delay > $maxDelay) {
                 $delay = $maxDelay;
             }
             $job->release($delay);
         }
         throw $e;
     }
 }
開發者ID:deboorn,項目名稱:expbackoffworker,代碼行數:31,代碼來源:Worker.php

示例5: fire

 /**
  * @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);
 }
開發者ID:adamnicholson,項目名稱:kyew,代碼行數:13,代碼來源:IlluminateQueueHandler.php

示例6: fire

 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();
 }
開發者ID:docit,項目名稱:git-hook,代碼行數:8,代碼來源:SyncProject.php

示例7: handleQueuedSending

 /**
  * 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();
 }
開發者ID:developerdynamo,項目名稱:laravel-push-notification,代碼行數:18,代碼來源:PushNotificationBridge.php

示例8: fire

 /**
  * 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();
 }
開發者ID:DavidIWilson,項目名稱:site1,代碼行數:20,代碼來源:DeleteTenant.php

示例9: writeOutput

 /**
  * Write the status output for the queue walker.
  *
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @param  bool  $failed
  * @return void
  */
 protected function writeOutput(Job $job, $failed)
 {
     if ($failed) {
         $this->output->writeln('<error>Failed:</error> ' . $job->getName());
     } else {
         $this->output->writeln('<info>Processed:</info> ' . $job->getName());
     }
 }
開發者ID:salopot,項目名稱:laravel-queue-walker,代碼行數:15,代碼來源:WalkCommand.php

示例10: raiseFailedJobEvent

 /**
  * Raise the failed queue job event.
  *
  * @param  string  $connection
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @return void
  */
 protected function raiseFailedJobEvent($connection, Job $job)
 {
     if ($this->events) {
         $data = json_decode($job->getRawBody(), true);
         $this->events->fire(new Events\JobFailed($connection, $job, $data));
     }
 }
開發者ID:teckwei1993,項目名稱:laravel-in-directadmin,代碼行數:14,代碼來源:Worker.php

示例11: writeOutput

 /**
  * Write the status output for the queue worker.
  *
  * @param  \Illuminate\Contracts\Queue\Job $job
  * @param  bool $failed
  * @return void
  */
 protected function writeOutput(Job $job, $failed)
 {
     if ($failed) {
         $this->output->writeln('<error>[' . Carbon::now()->format('Y-m-d H:i:s') . '] Failed:</error> ' . $job->getName());
     } else {
         $this->output->writeln('<info>[' . Carbon::now()->format('Y-m-d H:i:s') . '] Processed:</info> ' . $job->getName());
     }
 }
開發者ID:saj696,項目名稱:pipe,代碼行數:15,代碼來源:WorkCommand.php

示例12: handleFailedJob

 /**
  * Handle the failed job.
  *
  * @param  \Illuminate\Contracts\Queue\Job  $job
  * @param  \Exception  $e
  * @return array
  */
 protected function handleFailedJob(Job $job, $e)
 {
     $job->failed($e);
     $this->raiseFailedJobEvent($job, $e);
 }
開發者ID:bryanashley,項目名稱:framework,代碼行數:12,代碼來源:SyncQueue.php

示例13: fire

 /**
  * fire.
  *
  * @author Casper Rasmussen <cr@nodes.dk>
  *
  * @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();
 }
開發者ID:nodes-php,項目名稱:core,代碼行數:15,代碼來源:QueueMonitorJob.php

示例14: setSqsJob

 public function setSqsJob(Job $job)
 {
     $this->sqs_job = $job->getSqsJob();
 }
開發者ID:kirschbaum,項目名稱:laravel-sns-subscription-queues,代碼行數:4,代碼來源:QueueWorker.php

示例15: handleQueuedMessage

 /**
  * 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();
 }
開發者ID:Volicon,項目名稱:framework,代碼行數:12,代碼來源:Mailer.php


注:本文中的Illuminate\Contracts\Queue\Job類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。