/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Messenger/Handler/RedispatchMessageHandler.php
35 строк
1 KB
Grégoire Pineau
[Messenger] Use configured senders when RedispatchMessage has no transport name
06 авг 2026, 11:58
06 авг 2026, 11:58
b4a22d0
Код
Авторство
О чём код?
<?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\Handler; use Symfony\Component\Messenger\Message\RedispatchMessage; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Messenger\Stamp\HandledStamp; use Symfony\Component\Messenger\Stamp\TransportNamesStamp; final class RedispatchMessageHandler { public function __construct( private MessageBusInterface $bus, ) { } public function __invoke(RedispatchMessage $message): mixed { // no transport name means "use the senders configured for the message" instead of "use no sender" $transportNames = array_values(array_filter((array) $message->transportNames, static fn ($name): bool => '' !== $name)); $envelope = $this->bus->dispatch($message->envelope, $transportNames ? [new TransportNamesStamp($transportNames)] : []); return $envelope->last(HandledStamp::class)?->getResult(); } }