DispatchAfterCurrentBusMiddleware
in package
implements
MiddlewareInterface
Allow to configure messages to be handled after the current bus is finished.
I.e, messages dispatched from a handler with a DispatchAfterCurrentBus stamp will actually be handled once the current message being dispatched is fully handled.
For instance, using this middleware before the DoctrineTransactionMiddleware means sub-dispatched messages with a DispatchAfterCurrentBus stamp would be handled after the Doctrine transaction has been committed.
Tags
Table of Contents
Interfaces
Properties
- $isRootDispatchCallRunning : bool
- $queue : array<string|int, QueuedEnvelope>
Methods
Properties
$isRootDispatchCallRunning
private
bool
$isRootDispatchCallRunning
= false
this property is used to signal if we are inside a the first/root call to MessageBusInterface::dispatch() or if dispatch has been called inside a message handler
$queue
private
array<string|int, QueuedEnvelope>
$queue
= []
A queue of messages and next middleware
Methods
handle()
public
handle(Envelope $envelope, StackInterface $stack) : Envelope
Parameters
- $envelope : Envelope
- $stack : StackInterface