diff --git a/core/lib/Drupal/Core/Annotation/QueueWorker.php b/core/lib/Drupal/Core/Annotation/QueueWorker.php index 8b5df53..5409f4e 100644 --- a/core/lib/Drupal/Core/Annotation/QueueWorker.php +++ b/core/lib/Drupal/Core/Annotation/QueueWorker.php @@ -23,10 +23,15 @@ * the queue in this hook if you want, however, you need to take care of * processing the items in the queue in that case. * - * @see hook_cron() - * @see hook_queue_info_alter() + * Plugin Namespace: Plugin\QueueWorker + * + * For a working example, see + * \Drupal\aggregator\Plugin\QueueWorker\AggregatorRefresh. + * * @see \Drupal\Core\Queue\QueueWorkerInterface - * @see \Drupal\Core\Queue\QueueWorkerManagerInterface + * @see \Drupal\Core\Queue\QueueWorkerBase + * @see \Drupal\Core\Queue\QueueWorkerManager + * @see plugin_api * * @Annotation */ diff --git a/core/lib/Drupal/Core/Queue/QueueWorkerBase.php b/core/lib/Drupal/Core/Queue/QueueWorkerBase.php index 1a3dd44..7fe3417 100644 --- a/core/lib/Drupal/Core/Queue/QueueWorkerBase.php +++ b/core/lib/Drupal/Core/Queue/QueueWorkerBase.php @@ -10,7 +10,12 @@ use Drupal\Component\Plugin\PluginBase; /** - * Provides a basis for queue worker plugins. + * Provides a base implementation for a QueueWorker plugin. + * + * @see \Drupal\Core\Queue\QueueWorkerInterface + * @see \Drupal\Core\Queue\QueueWorkerManager + * @see \Drupal\Core\Annotation\QueueWorker + * @see plugin_api */ abstract class QueueWorkerBase extends PluginBase implements QueueWorkerInterface { diff --git a/core/lib/Drupal/Core/Queue/QueueWorkerInterface.php b/core/lib/Drupal/Core/Queue/QueueWorkerInterface.php index 376e5ad..ee4124a 100644 --- a/core/lib/Drupal/Core/Queue/QueueWorkerInterface.php +++ b/core/lib/Drupal/Core/Queue/QueueWorkerInterface.php @@ -10,13 +10,35 @@ use Drupal\Component\Plugin\PluginInspectionInterface; /** - * Defines an interface for queue workers. + * Defines an interface for a QueueWorker plugin. + * + * @see \Drupal\Core\Queue\QueueWorkerBase + * @see \Drupal\Core\Queue\QueueWorkerManager + * @see \Drupal\Core\Annotation\QueueWorker + * @see plugin_api */ interface QueueWorkerInterface extends PluginInspectionInterface { /** + * Works on a single queue item. + * * @param mixed $data - * Arbitrary data associated with the queued item being processed. + * The data that was passed to + * \Drupal\Core\Queue\QueueInterface::createItem() when the item was queued. + * + * @throws \Exception + * The worker callback may throw an exception to indicate there was a + * problem. The cron process will log the exception, and leave the item in + * the queue to be processed again later. + * @throws \Drupal\Core\Queue\SuspendQueueException + * More specifically, a SuspendQueueException should be thrown when the + * callback is aware that the problem will affect all subsequent workers of + * its queue. For example, a callback that makes HTTP requests may find that + * the remote server is not responding. The cron process will behave as with + * a normal Exception, and in addition will not attempt to process further + * items from the current item's queue during the current cron run. + * + * @see \Drupal\Core\Cron::run() */ public function processItem($data); diff --git a/core/lib/Drupal/Core/Queue/QueueWorkerManager.php b/core/lib/Drupal/Core/Queue/QueueWorkerManager.php index 6c140a8..6339065 100644 --- a/core/lib/Drupal/Core/Queue/QueueWorkerManager.php +++ b/core/lib/Drupal/Core/Queue/QueueWorkerManager.php @@ -13,6 +13,11 @@ /** * Defines the queue worker manager. + * + * @see \Drupal\Core\Queue\QueueWorkerInterface + * @see \Drupal\Core\Queue\QueueWorkerBase + * @see \Drupal\Core\Annotation\QueueWorker + * @see plugin_api */ class QueueWorkerManager extends DefaultPluginManager implements QueueWorkerManagerInterface { diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index b080149..7ef3bea 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -6,7 +6,6 @@ */ use Drupal\aggregator\Entity\Feed; -use Drupal\aggregator\FeedInterface; use Drupal\Component\Utility\Xss; use Drupal\Core\Routing\RouteMatchInterface; diff --git a/core/modules/locale/src/Plugin/QueueWorker/LocaleTranslation.php b/core/modules/locale/src/Plugin/QueueWorker/LocaleTranslation.php index 50e197a..a850b0d 100644 --- a/core/modules/locale/src/Plugin/QueueWorker/LocaleTranslation.php +++ b/core/modules/locale/src/Plugin/QueueWorker/LocaleTranslation.php @@ -14,6 +14,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** + * Executes interface translation queue tasks. + * * @QueueWorker( * id = "locale_translation", * title = @Translation("Update translations"),