CronQueueTestBrokenQueue.php

Same filename in other branches
  1. 9 core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestBrokenQueue.php

Namespace

Drupal\cron_queue_test\Plugin\QueueWorker

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

Title Deprecated Summary
CronQueueTestBrokenQueue Plugin annotation @QueueWorker( id = "cron_queue_test_broken_queue", title = @Translation("Broken queue test"), cron = {"time" = 60} )

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.