Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Messenger] Added UniqueStamp to help ensure ExactlyOnce semantics #36215

Open
wants to merge 1 commit into
base: master
from

Conversation

@ragboyjr
Copy link
Contributor

ragboyjr commented Mar 25, 2020

The unique stamp can be used to declare that a given message
should be unique inside of a queue awaiting processing. This
stamp should allow ensuring that certain messages don't get
double processed if they are already awaiting in the queue.

Example:

  • You have a queue for syncing product updates to an external
    service
  • On every product save, you enqueue an UpdatedProductMessage
  • The unique stamp would make sure that saving the same product
    multiple times will result in only one message in the queue
    preventing duplicated messages.

Signed-off-by: RJ Garcia ragboyjr@icloud.com

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets
License MIT
Doc PR TKTK
@ragboyjr ragboyjr requested a review from sroze as a code owner Mar 25, 2020
@ragboyjr ragboyjr force-pushed the ragboyjr:messenger-unique-stamp branch 2 times, most recently from 6f4e395 to 139be27 Mar 25, 2020
{
private $id;

public function __construct(?string $id = null)

This comment has been minimized.

Copy link
@Koc

Koc Mar 26, 2020

Contributor

What sense add this stamp without providing of id?

This comment has been minimized.

Copy link
@ragboyjr

ragboyjr Mar 26, 2020

Author Contributor

The transport could generate a unique id from like a hash of the message body. SQS for example supports both client supplied ids or allowing sqs to dedup it on their end.

This comment has been minimized.

Copy link
@ragboyjr

ragboyjr Mar 26, 2020

Author Contributor

But this is definitely something I should make clear in the documentation.

The unique stamp can be used to declare that a given message
should be unique inside of a queue awaiting processing. This
stamp should allow ensuring that certain messages don't get
double processed if they are already awaiting in the queue.

Example:

- You have a queue for syncing product updates to an external
  service
- On every product save, you enqueue an UpdatedProductMessage
- The unique stamp would make sure that saving the same product
  multiple times will result in only one message in the queue
  preventing duplicated messages.

Signed-off-by: RJ Garcia <ragboyjr@icloud.com>
@ragboyjr ragboyjr force-pushed the ragboyjr:messenger-unique-stamp branch from 139be27 to 5e40a2a Mar 26, 2020
@nicolas-grekas nicolas-grekas added this to the next milestone Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.