You are here

public function Flexible::process in Advanced Queue 8

Processes the given job.

Parameters

\Drupal\advancedqueue\Job $job: The job.

Return value

\Drupal\advancedqueue\JobResult The job result.

Overrides JobTypeInterface::process

File

tests/modules/advancedqueue_test/src/Plugin/AdvancedQueue/JobType/Flexible.php, line 22

Class

Flexible
Flexible job type.

Namespace

Drupal\advancedqueue_test\Plugin\AdvancedQueue\JobType

Code

public function process(Job $job) {
  $payload = $job
    ->getPayload();
  if (!empty($payload['expected_exception'])) {
    throw new \Exception($payload['expected_exception']);
  }
  return new JobResult($payload['expected_state'], $payload['expected_message'], isset($payload['max_retries']) ? $payload['max_retries'] : NULL, isset($payload['retry_delay']) ? $payload['retry_delay'] : NULL);
}