Closed
Description
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