class MessageWorker in Courier 8
Same name and namespace in other branches
- 2.x src/Plugin/QueueWorker/MessageWorker.php \Drupal\courier\Plugin\QueueWorker\MessageWorker
Triggers scheduled rules.
Plugin annotation
@QueueWorker(
id = "courier_message",
title = @Translation("Courier message processor"),
cron = {"time" = 30}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
- class \Drupal\courier\Plugin\QueueWorker\MessageWorker
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of MessageWorker
File
- src/
Plugin/ QueueWorker/ MessageWorker.php, line 22 - Contains \Drupal\courier\Plugin\QueueWorker\MessageWorker.
Namespace
Drupal\courier\Plugin\QueueWorkerView source
class MessageWorker extends QueueWorkerBase {
/**
* {@inheritdoc}
*
* @param $data
* - integer $id: ID of a courier_message_queue_item entity.
*/
public function processItem($data) {
$message_queue = MessageQueueItem::load($data['id']);
if ($message_queue) {
/** @var \Drupal\courier\Service\MessageQueueManagerInterface $service */
$service = \Drupal::service('courier.manager.message_queue');
$service
->sendMessage($message_queue);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MessageWorker:: |
public | function |
Overrides QueueWorkerInterface:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 92 |