Review main Merged

94833[BUGFIX] Honour `AsMessageHandler::$fromTransport` property

Stefan Bürk CR +2 V +2 Hard +613 −13 updated 08/02/26, 12:14

Commit message

Symfony Messenger's `AsMessageHandler` attribute offers a
`fromTransport` property to bind a handler to a receiving
transport, so the handler only runs for messages received
from that transport by a worker.

The attribute value was captured into the
`messenger.message_handler` DI tag, and the Symfony
`HandlersLocator` already evaluates it against the envelope's
`ReceivedStamp`, but `MessageHandlerPass` dropped the value
while building the handler map and `HandlersLocatorFactory`
had no way to store it. The property therefore had no effect
and such a handler ran for the message regardless of the
originating transport, making a separated asynchronous
send/receive setup impossible.

The value is now carried through the pass into the handler
descriptor as the `from_transport` option. A handler without
`fromTransport` keeps running for every matching message; a
handler bound to a transport only runs when the message
carries a matching `ReceivedStamp`, while a synchronously
handled message (no `ReceivedStamp`) is unaffected.

A handler may be bound to several transports. The definition
therefore accepts `null`, a single transport name or a list
of transport names. As the Symfony attribute only carries a
single name, multiple transports are expressed by repeating
the (repeatable) attribute; a list is available for service
tag registrations. Because `HandlersLocator` only matches a
scalar `from_transport`, a list is registered as one handler
descriptor per transport, and the resolved transports are
folded into the handler identifier so bindings for different
transports are not collapsed. Duplicate and empty names are
ignored and the handler still runs at most once per message.

This addresses the consumer side only. The sender side - a
wildcard route now acting as a fallback instead of fanning out
in addition to a matching specific route - is a separate
concern tracked in #101699 and #110223.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Benni Mack +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Benni Mack +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 3

Files 10

Review log 1724

  1. Stefan Bürk uploaded patch set 1 07/19/26, 14:16

  2. core-ci voted on patch set 1 V +1 07/19/26, 14:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104959

  3. Stefan Bürk uploaded patch set 2 V +1 07/19/26, 18:29

  4. core-ci voted on patch set 2 V +1 07/19/26, 18:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104965

  5. Stefan Bürk wrote 07/19/26, 19:34

    Topic set to messenger
  6. Stefan Bürk uploaded patch set 3 V +1 07/19/26, 20:38

  7. core-ci voted on patch set 3 V +1 07/19/26, 20:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104968

  8. Benni Mack commented on patch set 3 CR -1 07/20/26, 10:34

    the RST file needs to go into 13.4.x
  9. Stefan Bürk uploaded patch set 4 CR -1 V +1 07/20/26, 13:14

  10. core-ci voted on patch set 4 V +1 07/20/26, 13:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105029

  11. Oliver Klee voted on patch set 4 V +1 07/27/26, 07:51

  12. Benni Mack voted on patch set 4 CR +1 07/27/26, 13:35

  13. Stefan Bürk rebased onto patch set 5 CR +1 V +1 07/28/26, 06:29

  14. core-ci voted on patch set 5 V +1 07/28/26, 06:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105516

  15. Stefan Bürk updated the commit message in patch set 6 V +1 07/30/26, 06:16

  16. core-ci voted on patch set 6 V +1 07/30/26, 06:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105659

  17. Oliver Klee voted on patch set 6 V +1 07/30/26, 07:20

  18. Stefan Bürk uploaded patch set 7 V +1 08/01/26, 20:36

  19. core-ci voted on patch set 7 V +1 08/01/26, 20:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105815

  20. Oliver Klee voted on patch set 7 V +1 08/02/26, 08:50

  21. Simon Schaufelberger voted on patch set 7 CR +1 V +1 08/02/26, 08:57

  22. Benni Mack voted on patch set 7 CR +1 V +1 08/02/26, 08:59

  23. Stefan Bürk voted on patch set 7 CR +2 V +2 08/02/26, 11:48

  24. Stefan Bürk merged patch set 8 08/02/26, 12:14