8000 [Messenger] Provide a deduplication strategy to Queue · Issue #54126 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Messenger] Provide a deduplication strategy to Queue #54126
@VincentLanglet

Description

@VincentLanglet

Description

It would be useful to provide an easy way to handle duplicate message in queue.
I might be wrong but I found nothing implemented yet, just a discussion here #49215

The idea would be to propose something like an interface Message could implement

interface DeduplicatedMessageInterface

and if they doing so, when I try to publish such a message, it checks if the queue already has the same message with the same body. If so, the new message is not added to the queue.

I assume something could be possible with Symfony lock for instance:

  • Before dispatching the message we check there is no lock on the "message identifier".
    • If there is no lock, we're adding one.
    • If there is already a lock, we're not dispatching the message
  • And in the MessageHandler, we're releasing the lock after the execution of the __invoke method.

But maybe a better implementation exists ?

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0