3 namespace Drupal\Core\Queue;
5 use Drupal\Component\Plugin\PluginInspectionInterface;
8 * Defines an interface for a QueueWorker plugin.
10 * @see \Drupal\Core\Queue\QueueWorkerBase
11 * @see \Drupal\Core\Queue\QueueWorkerManager
12 * @see \Drupal\Core\Annotation\QueueWorker
15 interface QueueWorkerInterface extends PluginInspectionInterface {
18 * Works on a single queue item.
21 * The data that was passed to
22 * \Drupal\Core\Queue\QueueInterface::createItem() when the item was queued.
24 * @throws \Drupal\Core\Queue\RequeueException
25 * Processing is not yet finished. This will allow another process to claim
26 * the item immediately.
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
40 * @see \Drupal\Core\Cron::processQueues()
42 public function processItem($data);