class WebhookDispatcher in Webhooks 8
A Webhook dispatcher that dispatches webhooks on CRON run.
Plugin annotation
@QueueWorker(
  id = "webhooks_dispatcher",
  title = @Translation("Webhooks Dispatcher"),
  cron = {"time" = 60}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface- class \Drupal\webhooks\Plugin\QueueWorker\WebhookDispatcher implements ContainerFactoryPluginInterface
 
 
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of WebhookDispatcher
File
- src/Plugin/ QueueWorker/ WebhookDispatcher.php, line 22 
Namespace
Drupal\webhooks\Plugin\QueueWorkerView source
class WebhookDispatcher extends QueueWorkerBase implements ContainerFactoryPluginInterface {
  /**
   * The event dispatcher.
   *
   * @var \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher
   */
  protected $eventDispatcher;
  /**
   * WebhookDispatcherBase constructor.
   *
   * @param \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher $event_dispatcher
   *   The event dispathcer.
   */
  public function __construct(ContainerAwareEventDispatcher $event_dispatcher) {
    $this->eventDispatcher = $event_dispatcher;
  }
  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($container
      ->get('event_dispatcher'));
  }
  /**
   * {@inheritdoc}
   */
  public function processItem($data) {
    /** @var \Drupal\webhooks\Entity\WebhookConfig $webhook_config */
    $webhook_config = WebhookConfig::load($data['id']);
    if ($webhook_config) {
      $this->eventDispatcher
        ->dispatch(WebhookEvents::RECEIVE, new ReceiveEvent($webhook_config, $data['webhook']));
    }
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 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. | |
| WebhookDispatcher:: | protected | property | The event dispatcher. | |
| WebhookDispatcher:: | public static | function | Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: | |
| WebhookDispatcher:: | public | function | Works on a single queue item. Overrides QueueWorkerInterface:: | |
| WebhookDispatcher:: | public | function | WebhookDispatcherBase constructor. Overrides PluginBase:: | 
