[Messenger] remove interfaces/parent classes-based message subcription in favor of topic-based subscription #28993
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Subscribing to messages based on their interfaces or on their parent classes is very fragile, for example:
MessageSubscriberInterface::getHandledMessages()
doesn't work whenChainHandler
is involved - doing so correctly would require a much more dynamic logic to be correct (one based on asupports()
method called each time on each handler and for each message.)That's the same kind of issue that we had with type-based autowiring: bad DX, because changing a class declaration can lead to unrelated changes and unexpected side effects on the routing side.
The good news is that we have a nice alternative: topic-based dispatching (see 1st commit, coming from #28944 until it's merged.)