3 namespace Drupal\Core\Annotation;
5 use Drupal\Component\Annotation\Plugin;
8 * Declare a worker class for processing a queue item.
10 * Worker plugins are used by some queues for processing the individual items
11 * in the queue. In that case, the ID of the worker plugin needs to match the
12 * machine name of a queue, so that you can retrieve the queue back end by
13 * calling \Drupal\Core\Queue\QueueFactory::get($plugin_id).
15 * \Drupal\Core\Cron::processQueues() processes queues that use workers; they
16 * can also be processed outside of the cron process.
18 * Some queues do not use worker plugins: you can create queues, add items to
19 * them, claim them, etc. without using a QueueWorker plugin. However, you will
20 * need to take care of processing the items in the queue in that case. You can
21 * look at \Drupal\Core\Cron::processQueues() for an example of how to process
22 * a queue that uses workers, and adapt it to your queue.
24 * Plugin Namespace: Plugin\QueueWorker
26 * For a working example, see
27 * \Drupal\aggregator\Plugin\QueueWorker\AggregatorRefresh.
29 * @see \Drupal\Core\Queue\QueueWorkerInterface
30 * @see \Drupal\Core\Queue\QueueWorkerBase
31 * @see \Drupal\Core\Queue\QueueWorkerManager
36 class QueueWorker extends Plugin {
46 * The human-readable title of the plugin.
48 * @ingroup plugin_translatable
50 * @var \Drupal\Core\Annotation\Translation
55 * An associative array containing the optional key:
56 * - time: (optional) How much time Drupal cron should spend on calling
57 * this worker in seconds. Defaults to 15.
59 * @var array (optional)