当前位置: 首页>>代码示例>>PHP>>正文


PHP Job::release方法代码示例

本文整理汇总了PHP中Illuminate\Queue\Jobs\Job::release方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::release方法的具体用法?PHP Job::release怎么用?PHP Job::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Queue\Jobs\Job的用法示例。


在下文中一共展示了Job::release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fire

 /**
  * @param Job   $job
  * @param array $data
  *
  * @throws Exception
  */
 public function fire($job, $data)
 {
     $this->job = $job;
     if ($data['test1'] != 1 || $data['test2'] != 2) {
         throw new Exception("Parameters passed incorrectly" . var_export($data, true));
     }
     if (isset($data['delete'])) {
         $this->job->delete();
         return;
     }
     if (isset($data['release'])) {
         $this->job->release();
         return;
     }
 }
开发者ID:fhteam,项目名称:laravel-amqp,代码行数:21,代码来源:TestJobHandler.php

示例2: fire

 /**
  * @param Job   $job
  * @param array $data
  */
 public function fire(Job $job, $data)
 {
     $signalId = $data['signalId'];
     $signalResult = ResultSignal::find($signalId);
     if ($signalResult == null) {
         $job->delete();
         exit;
     }
     $url = $data['url'];
     $signalSid = $signalResult->signal_sid;
     $isSend = $this->makeCurl($url, $signalSid);
     //Если отправлен результат то удаляем задачу и ставим флаг
     if ($isSend) {
         $job->delete();
         $signalResult->setFlagUrlTrue();
         Log::info('Результат отправлен по http.');
     }
     $cnt = $job->attempts();
     if ($cnt > 50) {
         $job->delete();
         Log::info('Выполнено ' . $cnt . ' попыток отправить curl. Задача удалена.', $data);
         exit;
     }
     Log::info('Перевыставлена задача, попытка номер ' . $cnt, $data);
     $job->release(60);
 }
开发者ID:fintech-fab,项目名称:actions-calc,代码行数:30,代码来源:SendHttp.php

示例3: fire

 public function fire(Job $job, $data)
 {
     $doSuccess = false;
     // push to url
     if ($data['url']) {
         $curl = new Curl();
         $curl->post($data['url'], $data['data']);
         $doSuccess = $curl->ok();
         if (!$doSuccess) {
             Log::warning('callback.push.url', array('message' => 'callback push failed to ' . $data['url'], 'order' => $data['data']['order']));
         }
     }
     // push to email
     if ($data['email']) {
         Mail::send(array('text' => 'ff-bank-em::demo.email_callback'), $data, function (Message $message) use($data) {
             $message->to($data['email'])->subject('Bank Emulator Payment Message');
         });
         $doSuccess = 0 == count(Mail::failures());
         if (!$doSuccess) {
             Log::warning('callback.push.email', array('message' => 'callback push failed', 'order' => $data['data']['order']));
         }
     }
     // release, if error
     if ($doSuccess) {
         Log::info('callback.push', array('order' => $data['data']['order']));
         $job->delete();
     } else {
         Log::warning('callback.push', array('order' => $data['data']['order']));
         if ($job->attempts() > 10) {
             $job->delete();
         } else {
             $job->release(60);
         }
     }
 }
开发者ID:fintech-fab,项目名称:bank-emulator,代码行数:35,代码来源:CallbackQueue.php

示例4: fire

 /**
  * @param Job   $job
  * @param array $data
  */
 public function fire(Job $job, array $data)
 {
     if (empty($data['url'])) {
         $job->delete();
         Log::info('Не указан url для отправки callback.');
         return;
     }
     $ch = curl_init($data['url']);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_USERPWD, $data['merchant_id'] . ':' . $data['merchant_pass']);
     if ($data['sign'] != '') {
         curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Api-Signature:' . $data['sign']));
     }
     unset($data['url'], $data['merchant_id'], $data['merchant_pass'], $data['sign']);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     $result = curl_exec($ch);
     $httpError = curl_error($ch);
     Log::info('Ошибки curl:', array('httpError' => $httpError));
     if (!empty($result) && strpos($result, '<result_code>0</result_code>') !== false) {
         Log::info('Успешно вызван callback с ответом 0', array('result' => $result));
         $job->delete();
         return;
     }
     Log::info('Результат curl:', array('result' => $result));
     $cnt = $job->attempts();
     if ($cnt > 50) {
         $job->delete();
         return;
     }
     Log::info('Перевыставлена задача по отправке curl, попытка номер ' . $cnt, $data);
     $job->release(60 * $cnt);
 }
开发者ID:fintech-fab,项目名称:qiwi-gate,代码行数:37,代码来源:SendCallback.php

示例5: release

 /**
  * Release the job back into the queue.
  *
  * @param int $delay
  */
 public function release($delay = 1)
 {
     parent::release($delay);
     if ($delay < 1) {
         $delay = 1;
     }
     $this->adapter->changeMessageVisibility($this->job->getReceiptHandle(), $delay);
 }
开发者ID:lokielse,项目名称:laravel-mns,代码行数:13,代码来源:MNSJob.php

示例6: release

 /**
  * Release the job back into the queue.
  *
  * @param  int   $delay
  * @return void
  */
 public function release($delay = 0)
 {
     parent::release($delay);
     if (!$this->pushed) {
         $this->delete();
     }
     $this->recreateJob($delay);
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:14,代码来源:IronJob.php

示例7: fire

 public function fire(Job $job, $models)
 {
     try {
         foreach ($models as $model) {
             list($class, $id) = explode(':', $model);
             $model = $class::findOrFail($id);
             $model->refreshDoc($model);
         }
         $job->delete();
     } catch (ModelNotFoundException $e) {
         $job->release(60);
     }
 }
开发者ID:geekybeaver,项目名称:larasearch,代码行数:13,代码来源:ReindexJob.php

示例8: process

 /**
  * 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;
     }
 }
开发者ID:centaurustech,项目名称:sagip,代码行数:25,代码来源:Worker.php

示例9: fire

 public function fire(Job $job, $models)
 {
     $loggerContainerBinding = $this->config->get('logger', 'menthol.flexible.logger');
     $logger = $this->app->make($loggerContainerBinding);
     foreach ($models as $model) {
         list($class, $id) = explode(':', $model);
         $logger->info('Indexing ' . $class . ' with ID: ' . $id);
         try {
             $model = $class::findOrFail($id);
             if (method_exists($model, 'getProxy')) {
                 $model->refreshDoc($model);
             }
         } catch (Exception $e) {
             $logger->error('Indexing ' . $class . ' with ID: ' . $id . ' failed: ' . $e->getMessage());
             $job->release(60);
         }
     }
     $job->delete();
 }
开发者ID:menthol,项目名称:Flexible,代码行数:19,代码来源:ReindexJob.php

示例10: release

 /**
  * Release the job back into the queue.
  *
  * @param int $delay
  *
  * @return void
  */
 public function release($delay = 0)
 {
     parent::release($delay);
     $this->delete();
     $this->setAttempts($this->attempts() + 1);
     $body = $this->payload();
     /*
      * Some jobs don't have the command set, so fall back to just sending it the job name string
      */
     if (isset($body['data']['command']) === true) {
         $job = unserialize($body['data']['command']);
     } else {
         $job = $this->getName();
     }
     $data = $body['data'];
     if ($delay > 0) {
         $this->connection->later($delay, $job, $data, $this->getQueue());
     } else {
         $this->connection->push($job, $data, $this->getQueue());
     }
 }
开发者ID:eupathy,项目名称:laravel-queue-rabbitmq,代码行数:28,代码来源:RabbitMQJob.php

示例11: fire

 /**
  * @param Job   $job
  * @param array $data
  */
 public function fire(Job $job, array $data)
 {
     if (empty($data['email'])) {
         $job->delete();
         Log::info('Не указан url для отправки callback.');
         return;
     }
     switch ($data['status']) {
         case Bill::C_STATUS_EXPIRED:
             $data['textStatus'] = ' просрочен.';
             break;
         case Bill::C_STATUS_PAID:
             $data['textStatus'] = ' оплачен.';
             break;
         case Bill::C_STATUS_REJECTED:
             $data['textStatus'] = ' отменён.';
             break;
         default:
             $data['textStatus'] = null;
     }
     $this->email = $data['email'];
     $this->billId = $data['bill_id'];
     $this->textStatus = $data['textStatus'];
     Mail::send('ff-qiwi-gate::emails.sendCallbackMail', $data, function (Message $message) {
         $message->to($this->email)->subject('Счёт №' . $this->billId . $this->textStatus);
     });
     $cntSendFails = count(Mail::failures());
     if ($cntSendFails == 0) {
         $job->delete();
         Log::info('Почта отправлена.', $data);
         return;
     }
     $cnt = $job->attempts();
     if ($cnt > 50) {
         $job->delete();
         return;
     }
     Log::info('Перевыставлена задача по отправке почты, попытка номер ' . $cnt, $data);
     $job->release(60 * $cnt);
 }
开发者ID:fintech-fab,项目名称:qiwi-gate,代码行数:44,代码来源:SendEmail.php

示例12: release

 /**
  * @param DateTime|int $delay
  */
 public function release($delay = 0)
 {
     $delay = $this->getSeconds($delay);
     parent::release($delay);
     // reject the message.
     try {
         $this->amqpQueue->reject($this->amqpMessage->getDeliveryTag());
     } catch (\AMQPException $e) {
         // void for now
     }
     $body = json_decode($this->amqpMessage->getBody(), true);
     $job = $body['job'];
     $data = $body['data'];
     // increment the attempt counter
     if (isset($data['attempts'])) {
         $data['attempts']++;
     } else {
         $data['attempts'] = 1;
     }
     if ($delay > 0) {
         $this->laravelQueue->later($delay, $job, $data, $this->amqpQueue->getName());
     } else {
         $this->laravelQueue->push($job, $data, $this->amqpQueue->getName());
     }
 }
开发者ID:garbetjie,项目名称:laravel-amqp-queue,代码行数:28,代码来源:Job.php

示例13: release

 /**
  * Release the job back into the queue.
  *
  * @param  int  $delay
  * @return void
  */
 public function release($delay = 0)
 {
     parent::release($delay);
     $this->delete();
     $this->database->release($this->queue, $this->job, $delay);
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:12,代码来源:DatabaseJob.php

示例14: release

 /**
  * Release the job back into the queue.
  *
  * @param  int $delay
  * @return void
  */
 public function release($delay = 0)
 {
     parent::release($delay);
     $this->recreateJob($delay);
 }
开发者ID:bobkosse,项目名称:l5-stomp-queue,代码行数:11,代码来源:StompJob.php

示例15: bury

 /**
  * Bury the job in the queue.
  *
  * @return void
  */
 public function bury()
 {
     parent::release();
     $this->pheanstalk->bury($this->job);
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:10,代码来源:BeanstalkdJob.php


注:本文中的Illuminate\Queue\Jobs\Job::release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。