-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Proper message decoding error handling #50043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Messenger] Proper message decoding error handling #50043
Conversation
94409d1
to
5a01ab9
Compare
72a5cb3
to
08b0850
Compare
6f0f923
to
796da17
Compare
60068ef
to
d3f1e14
Compare
d3f1e14
to
67fb47c
Compare
Hello @alex-dev, |
I could not justify spending more time on this to update it. Seeing Symfony had little interest in this fix, my company chose to implement a solution inside the transport layer. It is hacked, but the right behavior is guaranteed. |
@alex-dev any chance you could share your solution? |
We just reimplemented the transport and made rejection a no-op. There are a few annoying caveats.
Other alternative would be to reimplement the worker and associated commands (what this PR more or less does). |
Problem
Handling deserialization in transports prevents actual error handling from running... And depending on transports, can even drop messages. While envelope and stamps deserialization failures may be actual error warranting undefined behavior, message denormalization failures is merely an application concern. Symfony should never drop messages that are broken by the application.
Solution
Reusing some part of #39622:
PhpSerializer
andSerializer
do not throw error in message deserializationPhpSerializer
MessageDecodingFailedStamp
inWorker
AbstractFailedMessagesCommand
BC breaks
Messenger\Transport\Serialization\Serializer::__construct()
first arguments goes from?SerializerInterface $serializer = null
toDecoderInterface&DenormalizerInterface&SerializerInterface $serializer
Messenger\Transport\Serialization\Serializer::create()
still return a default constructed instance