Hi guys, I was looking into `Enqueue\Client\Producer::prepareBody` and realized that there is no way to use custom serializer in this context apart JSON
Activity
makasim commentedon Jan 9, 2018
Hi,
It is possible via client extension: https://github.com/php-enqueue/enqueue-dev/blob/master/docs/client/extensions.md
aurimasniekis commentedon Jan 9, 2018
But validation of content type will be done before extensions are called: https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/enqueue/Client/Producer.php#L54
makasim commentedon Jan 9, 2018
True, so we need an extra extension point, which is called before
prepareBodymethod. Something likeprePrepareBody.aurimasniekis commentedon Jan 9, 2018
Yep, would be awesome, as I am want to use serialized objects ;)
makasim commentedon Jan 9, 2018
@aurimasniekis would be great if you could open a PR.
aurimasniekis commentedon Jan 9, 2018
If we going to extend ExtensionInterface it will cause breaking changes...
makasim commentedon Aug 30, 2018
@aurimasniekis in 0.9 you can do it by adding an extension with onPreSendEvent or onPreSendCommand method that converts body to a string.
Take a look at default one https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/enqueue/Client/Extension/PrepareBodyExtension.php#L15