Messenger is a great component, but has some drawbacks when it comes to send messages across different apps which use messenger.
Let's pretend an app A sends message through rabbitMQ, that will be consumed by an app B
Messages needs to be "sanitized" before leaving the app:
stamps should be removed: if a stamp exists in app A and not in app B, when A sends messages to B, an error could occur. As well as if app A uses a bus which not exist in app B, B will try to get a bus which does not exist and an error will be thrown.
header type could also be problematic: if PHP message objects in both apps do not have the same FQCN, when app B receives the message it will try to deserialize it in a class which does not exist.
A solution would be to add a new interface ExternalMessageInterface and take some actions when the interface is encountered in \Symfony\Component\Messenger\Transport\Serialization\Serializer.
Description
Hello,
Messenger is a great component, but has some drawbacks when it comes to send messages across different apps which use messenger.
Let's pretend an app
A
sends message through rabbitMQ, that will be consumed by an appB
Messages needs to be "sanitized" before leaving the app:
A
and not in appB
, whenA
sends messages toB
, an error could occur. As well as if appA
uses a bus which not exist in appB
,B
will try to get a bus which does not exist and an error will be thrown.type
could also be problematic: if PHP message objects in both apps do not have the same FQCN, when appB
receives the message it will try to deserialize it in a class which does not exist.A solution would be to add a new interface
ExternalMessageInterface
and take some actions when the interface is encountered in\Symfony\Component\Messenger\Transport\Serialization\Serializer
.I don't think we could fix this with a middleware, because the header
type
is added at serialization time.I'd like to have some feedback on this before fixing it.
Thanks :)
The text was updated successfully, but these errors were encountered: