Patched to Drupal 8.4.8 level. See https://www.drupal.org/sa-core-2018-004 and patch...
[yaffs-website] / web / core / lib / Drupal / Core / Queue / QueueWorkerInterface.php
1 <?php
2
3 namespace Drupal\Core\Queue;
4
5 use Drupal\Component\Plugin\PluginInspectionInterface;
6
7 /**
8  * Defines an interface for a QueueWorker plugin.
9  *
10  * @see \Drupal\Core\Queue\QueueWorkerBase
11  * @see \Drupal\Core\Queue\QueueWorkerManager
12  * @see \Drupal\Core\Annotation\QueueWorker
13  * @see plugin_api
14  */
15 interface QueueWorkerInterface extends PluginInspectionInterface {
16
17   /**
18    * Works on a single queue item.
19    *
20    * @param mixed $data
21    *   The data that was passed to
22    *   \Drupal\Core\Queue\QueueInterface::createItem() when the item was queued.
23    *
24    * @throws \Drupal\Core\Queue\RequeueException
25    *   Processing is not yet finished. This will allow another process to claim
26    *   the item immediately.
27    * @throws \Exception
28    *   A QueueWorker plugin may throw an exception to indicate there was a
29    *   problem. The cron process will log the exception, and leave the item in
30    *   the queue to be processed again later.
31    * @throws \Drupal\Core\Queue\SuspendQueueException
32    *   More specifically, a SuspendQueueException should be thrown when a
33    *   QueueWorker plugin is aware that the problem will affect all subsequent
34    *   workers of its queue. For example, a callback that makes HTTP requests
35    *   may find that the remote server is not responding. The cron process will
36    *   behave as with a normal Exception, and in addition will not attempt to
37    *   process further items from the current item's queue during the current
38    *   cron run.
39    *
40    * @see \Drupal\Core\Cron::processQueues()
41    */
42   public function processItem($data);
43
44 }