if (null !==
$e) { if ($rejectFirst =
$e instanceof RejectRedeliveredMessageException
) { // redelivered messages are rejected first so that continuous failures in an event listener or while
// publishing for retry does not cause infinite redelivery loops
$receiver->
reject($envelope);
} if ($e instanceof HandlerFailedException
) { $envelope =
$e->
getEnvelope();
} $failedEvent =
new WorkerMessageFailedEvent($envelope,
$transportName,
$e);
$this->eventDispatcher?->
dispatch($failedEvent);
$envelope =
$failedEvent->
getEnvelope();
if (!
$rejectFirst) { $receiver->
reject($envelope);
} continue;
}