Provide a deduplication strategy

Created on 30 September 2024, 4 months ago

Motivation

Sometimes, only one instance of a message must be present in a transport at a time.

Proposed resolution

Implement something like: https://github.com/symfony/symfony/issues/54126.

Remaining tasks

Implement/test

User interface changes

None

API changes

A new Stamp will be added to flag a message to be unique

Data model changes

None

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇮🇹Italy lussoluca Italy

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @lussoluca
  • 🇦🇺Australia dpi Perth, Australia

    Keen to see something like this, I'd support whatever comes in the official Symfony Messenger project but don't see a need to preempt it.

    Could a solution be incubated in a separate project that relies on any MR thats available over there?

  • 🇮🇹Italy lussoluca Italy

    Yes, of course, we can do that in a separate project.

    Something like sm_deduplicate ?

  • 🇮🇹Italy lussoluca Italy

    @dpi I've pushed a new (sandbox) project for sm_deduplicate: https://www.drupal.org/sandbox/lussoluca/3481678

  • 🇦🇺Australia dpi Perth, Australia

    Looks good, curious about the range of time and how that works and is documented.

  • 🇮🇹Italy lussoluca Italy

    > It seems it will dedupe for a short range of time, but not over say, an hour.

    By default, the lock is set to last 5 minutes (300 seconds), but you can configure it when you apply the stamp to the envelope:

    new LockStamp(\hash('sha256', \serialize($message)), 3600)
    

    We need to write extensive documentation about how it works.

Production build 0.71.5 2024