[Messenger Doctrine] Support for igbinary
serializer and binary
message body
column
#52877
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.
Description
This PR introduces alternative Messenger Transport, the igbinary serializer
Symfony\Component\Messenger\Transport\Serialization\IgbinarySerializer
and deepens the support by also modifyingSymfony\Component\Messenger\Bridge\Doctrine\Transport\Connection
to supportbinary
column type whenever this serializer is enabled.The
igbinary
serializer is by default 1-5 times faster and it's output is around 30-120% shorter than PHP's build-inserialize
. Added serializer was also stripped of thebase64
pass both onencode
anddecode
to further speed up the conversion. To supportbinary
messagebody
we also need to modify the Doctrine transport connection, so it works withbinary
column type instead oftext
.Every DBAL supported database except Sqlite supports
binary
columns and installingigbinary
extension is easy as installing alteady builtphp-igbinary
package from repos and in other casespecl install igbinary
can be used.With this PR tests might be broken as they now require
ext-igbinary
to be installed - maybe this can be skipped if it's not installed?Questions
Symfony\Component\Messenger\Bridge\Doctrine\Transport\Connection
so it knows if it should usebinary
ortext
column type forbody
without making BC. Please let me know if the current approach is fine or not.psalm
error about non existentDoctrine\DBAL\Platforms\SqlitePlatform
? Do I need to useclass_implements($platform)
within_array()
or is there a better solution? I need to check whenever the used platform is Sqlite to throw exception.