You are here

ReportWorkerTwo.php in Examples for Developers 3.x

File

modules/cron_example/src/Plugin/QueueWorker/ReportWorkerTwo.php
View source
<?php

namespace Drupal\cron_example\Plugin\QueueWorker;


/**
 * A report worker.
 *
 * @QueueWorker(
 *   id = "cron_example_queue_2",
 *   title = @Translation("Second worker in cron_example"),
 *   cron = {"time" = 20}
 * )
 *
 * QueueWorkers are new in Drupal 8. They define a queue, which in this case
 * is identified as cron_example_queue_2 and contain a process that operates on
 * all the data given to the queue.
 *
 * @see queue_example.module
 */
class ReportWorkerTwo extends ReportWorkerBase {

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {
    $this
      ->reportWork(2, $data);
  }

}

Classes

Namesort descending Description
ReportWorkerTwo A report worker.