By voleger on
Change record status:
Draft (View all draft change records)
Project:
Introduced in branch:
11.x
Introduced in version:
11.4.0
Issue links:
Description:
Before:
// ...
// Content of settings.php file.
$settings['queue_service_' . $queue_worker_id] = \Drupal\Core\Queue\QueueDatabaseFactory::class;
//...
After:
// ...
// Content of queue worker plugin file.
/**
* Process a queue of media items to fetch their thumbnails.
*/
#[QueueWorker(
id: 'media_entity_thumbnail',
title: new TranslatableMarkup('Thumbnail downloader'),
cron: ['time' => 60],
queue_service: \Drupal\Core\Queue\QueueDatabaseFactory::class,
)]
class ThumbnailDownloader extends QueueWorkerBase implements ContainerFactoryPluginInterface {
// ...
Altering capabilities
Now, as the service name is part of the queue worker plugin definition information, it can be altered via the queue plugin manager hook_info:
#[Hook('queue_info_alter')]
public static function queueInfoAlter(array &$queues): void {
$queues['media_entity_thumbnail']['queue_service'] = \Drupal\Core\Queue\QueueDatabaseFactory::class;
}
Changes in the class definition:
Class Drupal\Core\Queue\QueueFactory now takes the QueueWorkerManagerInterface dependency in the constructor as a new argument.
Impacts:
Module developers
Site templates, recipes and distribution developers