Closed
Description
Symfony version(s) affected: <=4.3
Description
All messages are published to rabbitmq with content_type
as plain/text
, even though they're serialised as json. It makes it harder to consume messages with other technologies (like spring), which recognise the header to decide how to decode the message.
How to reproduce
Configure the messenger to use the symfony_serializer
instead of the php one:
framework:
messenger:
transports:
amqp:
dsn: 'amqp://admin:admin@localhost:5672/%2f/foo'
serializer: 'messenger.transport.symfony_serializer'
routing:
'App\Message\Foo': amqp
Publish a message and inspect content_type in rabbitmq.
Possible Solution
During serialisation create an AmqpStamp
instance with the content_type
attribute set based on the serialisation format.
The drawback would be that only the last AmqpStamp
is currently read, so any AmqpAdmin stamps add by user land code would override it.