/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Messenger/Middleware/FailedMessageProcessingMiddleware.php
34 строки
1 KB
Nicolas Grekas
[Messenger] Route decode failures through failure handling
24 фев 2026, 18:12
24 фев 2026, 18:12
37c7e90
Код
Авторство
О чём код?
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Messenger\Middleware; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Stamp\ReceivedStamp; use Symfony\Component\Messenger\Stamp\SentToFailureTransportStamp; /** * @author Ryan Weaver <ryan@symfonycasts.com> */ class FailedMessageProcessingMiddleware implements MiddlewareInterface { public function handle(Envelope $envelope, StackInterface $stack): Envelope { // look for "received" messages decorated with the SentToFailureTransportStamp if ($envelope->last(ReceivedStamp::class) && $sentToFailureStamp = $envelope->last(SentToFailureTransportStamp::class)) { // mark the message as "received" from the original transport // this guarantees the same behavior as when originally received $envelope = $envelope->with(new ReceivedStamp($sentToFailureStamp->getOriginalReceiverName())); } return $stack->next()->handle($envelope, $stack); } }