本文整理汇总了PHP中Illuminate\Queue\Jobs\Job::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::delete方法的具体用法?PHP Job::delete怎么用?PHP Job::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Queue\Jobs\Job
的用法示例。
在下文中一共展示了Job::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* @param Job $syncJob Laravel queue job
* @param $arguments
* @return bool
* @throws \Unifact\Connector\Exceptions\HandlerException
*/
public function fire(Job $syncJob, $arguments)
{
try {
$job = $this->jobRepo->findById($arguments['job_id']);
$job->setPreviousStatus($arguments['previous_status']);
$handler = forward_static_call([$job->handler, 'make']);
$this->logger->debug("Preparing Job..");
if (!$handler->prepare()) {
$this->logger->error('Handler returned FALSE in prepare() method, see log for details');
// delete Laravel queue job
$syncJob->delete();
return false;
}
$this->logger->debug("Handling Job..");
if ($handler->handle($job) === false) {
$this->logger->error('Handler returned FALSE in handle() method, see log for details');
// delete Laravel queue job
$syncJob->delete();
return false;
}
$this->logger->debug("Completing Job..");
$handler->complete();
$this->logger->info('Finished Job successfully');
} catch (\Exception $e) {
$this->oracle->exception($e);
$this->logger->error('Exception was thrown in JobQueueHandler::fire method.');
$this->jobRepo->update($arguments['job_id'], ['status' => 'error']);
// delete Laravel queue job
$syncJob->delete();
return false;
}
// delete Laravel queue job
$syncJob->delete();
return true;
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
}
}
示例5: 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;
}
}
示例6: fire
/**
* Sends an email
*
* @param \Illuminate\Queue\Jobs\Job $sqsJob
* @param array $data
*
* @return void
*/
public function fire($sqsJob, $params)
{
// Get the needed parameters
$domain = $params[0];
$view = $params[1];
$data = $params[2];
$messageData = $params[3];
$driver = isset($params[4]) ? $params[4] : null;
// If using a specific driver, set it now
if (!is_null($driver)) {
Config::set('mail.driver', $driver);
}
// If not using the mailgun driver, send normally ignoring the domain
if (Config::get('mail.driver') !== 'mailgun') {
$this->send($view, $data, $messageData);
// Otherwise, adjust the mailgun domain dynamically
} else {
// Backup your default mailer
$backup = Mail::getSwiftMailer();
// Setup your mailgun transport
$transport = new MailgunTransport(Config::get('services.mailgun.secret'), $domain);
$mailer = new Swift_Mailer($transport);
// Set the new mailer with the domain
Mail::setSwiftMailer($mailer);
// Send your message
$this->send($view, $data, $messageData);
// Restore the default mailer instance
Mail::setSwiftMailer($backup);
}
$sqsJob->delete();
}
示例7: fire
public function fire(\Illuminate\Queue\Jobs\Job $job, array $data)
{
if (!$this->index_product_repo->updateIndex($data['fields'], false)) {
throw new \RunTimeException('Index operation failed: ' . $this->index_product_repo->errors());
}
$job->delete();
}
示例8: delete
/**
* Delete the job from the queue.
*
* @return void
*/
public function delete()
{
parent::delete();
if (isset($this->job->pushed)) {
return;
}
}
示例9: fire
public function fire(Job $job, array $data)
{
$command = PostToCallback::create($data['image_id']);
$command->execute();
// End job
$job->delete();
}
示例10: fire
/**
* @param Job $job
* @param array $data
*/
public function fire(Job $job, $data)
{
Log::info('Получен запрос через очередь с параметрами:', $data);
Validators::ValidateRequest($data);
$mainHandler = new MainHandler();
$mainHandler->processRequest($data);
$job->delete();
}
示例11: fire
public function fire(Job $job, array $data)
{
if ($this->filesystem->exists($data['filepath'])) {
$this->filesystem->delete($data['filepath']);
}
// End job
$job->delete();
}
示例12: delete
/**
* Delete the job from the queue.
*
* @return void
*/
public function delete()
{
parent::delete();
if (isset($this->job->pushed)) {
return;
}
$this->iron->deleteMessage($this->getQueue(), $this->job->id);
}
示例13: fire
public function fire(Job $job, array $data)
{
// Process Image
$command = ImageColorAnalysis::create($data['image_id']);
$command->execute();
// End job
$job->delete();
}
示例14: fire
/**
* Called by the illuminate queue.
*
* @param \Illuminate\Queue\Jobs\Job $job
* @param array $data Data that has been added by the Laravel handler.
*
* @return void
*/
public function fire(IlluminateJob $job, array $data)
{
if (empty($this->transport)) {
$this->transport = new $data['transport']['class']($data['transport']['options']);
}
$this->transport->send($data['url'], $data['data'], $data['headers']);
$job->delete();
}
示例15: fire
public function fire(Job $job, $models)
{
foreach ($models as $model) {
list($class, $id) = explode(':', $model);
$model = new $class();
$model->deleteDoc($id);
}
$job->delete();
}