\Drupal\strata\Plugin\QueueWorker WebhookDelivery

Posts one queued webhook delivery.

The delay is enforced here rather than by the queue backend, because the database queue core ships cannot hold an item until a moment - DelayableQueueInterface is implemented by some backends and not that one. An item that is not due yet is re-queued untouched, which costs one cheap read and keeps the backoff honest on every backend.

Summary

Methods
Properties
Constants
__construct
create
processItem
No public properties found
No public constants found
No protected methods found
dispatcher
time
logger
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$dispatcher

$dispatcher : \Drupal\strata\Event\Webhook\WebhookDispatcher

Type

WebhookDispatcher

$time

$time : \Drupal\Component\Datetime\TimeInterface

Type

TimeInterface

$logger

$logger : \Psr\Log\LoggerInterface

Type

LoggerInterface

Methods

__construct()

__construct(array  $configuration, string  $pluginId, mixed  $pluginDefinition, \Drupal\strata\Event\Webhook\WebhookDispatcher  $dispatcher, \Drupal\Component\Datetime\TimeInterface  $time, \Psr\Log\LoggerInterface  $logger) : mixed

Constructs a worker.

Parameters

array $configuration

Plugin configuration.

string $pluginId

The plugin id.

mixed $pluginDefinition

The plugin definition.

\Drupal\strata\Event\Webhook\WebhookDispatcher $dispatcher

Performs the attempt.

\Drupal\Component\Datetime\TimeInterface $time

Decides whether an item is due.

\Psr\Log\LoggerInterface $logger

Records a delivery that failed in a way the dispatcher did not expect.

Returns

mixed —

create()

create(\Symfony\Component\DependencyInjection\ContainerInterface  $container, array  $configuration, mixed  $plugin_id, mixed  $plugin_definition) : self

{@inheritdoc}

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container
array $configuration
mixed $plugin_id
mixed $plugin_definition

Returns

self —

processItem()

processItem(mixed  $data) : void

{@inheritdoc}

Everything below the requeue is caught, including an Error. Cron::processQueues() catches Exception and nothing wider, so a TypeError raised by a malformed item does not fail that item - it aborts the whole cron run, and every module whose cron had not gone yet is skipped for as long as the lock is held. A webhook that cannot be delivered is not worth that.

Parameters

mixed $data

The queue item.

Throws

\Drupal\Core\Queue\RequeueException

When the item is not due yet. Thrown past the catch, since it is how a worker says "later" rather than a failure.

Returns

void —