Skip to content

[Messenger] Sanitize message when the receiver is another app #49081

@nikophil

Description

@nikophil

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 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.

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy