You are here

CronQueueTestBrokenQueue.php in Drupal 8

File

core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestBrokenQueue.php
View source
<?php

namespace Drupal\cron_queue_test\Plugin\QueueWorker;

use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\Core\Queue\SuspendQueueException;

/**
 * @QueueWorker(
 *   id = "cron_queue_test_broken_queue",
 *   title = @Translation("Broken queue test"),
 *   cron = {"time" = 60}
 * )
 */
class CronQueueTestBrokenQueue extends QueueWorkerBase {

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {
    if ($data == 'crash') {
      throw new SuspendQueueException('The queue is broken.');
    }

    // Do nothing otherwise.
  }

}

Classes

Namesort descending Description
CronQueueTestBrokenQueue Plugin annotation @QueueWorker( id = "cron_queue_test_broken_queue", title = @Translation("Broken queue test"), cron = {"time" = 60} )