CONFIG
CONFIG = 'strata.webhooks'
The configuration object subscriptions are read from.
Queues one delivery per interested endpoint, and performs one attempt at a time.
Nothing is posted inline. A commit is sealed inside a web request, and a subscriber that made an outbound HTTP call there would put a slow or unreachable endpoint directly into the site's own response time - and a failed one into the flush's error path, where it does not belong. So a dispatch writes queue items and returns; the queue worker does the posting on cron.
The body is rendered ONCE per event and reused for every subscription. The signature covers those exact bytes, so re-encoding per endpoint would risk two endpoints being sent bodies that differ in key order and one of them failing verification.
A secret is never written to the queue. The item carries the URL, and the worker resolves the subscription again at delivery time; a subscription removed while its deliveries were waiting is dropped rather than sent.
__construct(\GuzzleHttp\ClientInterface $http, \Drupal\Core\Config\ConfigFactoryInterface $configFactory, \Drupal\Core\Queue\QueueFactory $queues, \Drupal\Component\Datetime\TimeInterface $time, \Psr\Log\LoggerInterface $logger) : mixed
Constructs a dispatcher.
| \GuzzleHttp\ClientInterface | $http | The HTTP client deliveries are posted with. |
| \Drupal\Core\Config\ConfigFactoryInterface | $configFactory | Where subscriptions are read from. |
| \Drupal\Core\Queue\QueueFactory | $queues | Where deliveries wait. |
| \Drupal\Component\Datetime\TimeInterface | $time | The clock a signature is stamped from. |
| \Psr\Log\LoggerInterface | $logger | Records a delivery that failed every attempt. |
post(\Drupal\strata\Event\Webhook\WebhookSubscription $subscription, string $event, string $body, string $delivery) : bool
Posts one delivery.
| \Drupal\strata\Event\Webhook\WebhookSubscription | $subscription | Where it goes. |
| string | $event | The event name. |
| string | $body | The exact bytes to send. |
| string | $delivery | The delivery id. |
TRUE when the endpoint answered with a 2xx.