private bool
$isRootDispatchCallRunning = false;
public function handle(Envelope
$envelope, StackInterface
$stack): Envelope
{ if (null !==
$envelope->
last(DispatchAfterCurrentBusStamp::
class)) { if ($this->isRootDispatchCallRunning
) { $this->queue
[] =
new QueuedEnvelope($envelope,
$stack);
return $envelope;
} $envelope =
$envelope->
withoutAll(DispatchAfterCurrentBusStamp::
class);
} if ($this->isRootDispatchCallRunning
) { /*
* A call to MessageBusInterface::dispatch() was made from inside the main bus handling,
* but the message does not have the stamp. So, process it like normal.
*/
return $stack->
next()->
handle($envelope,
$stack);
} // First time we get here, mark as inside a "root dispatch" call: