Skip to content

Improve handling of messages with same MessageGroupId in SQS Batch processor #1140

Closed
@MartinMitro

Description

@MartinMitro

Key information

  • RFC PR: (leave this empty)
  • Related issue(s), if known:
  • Area: (i.e. Tracer, Metrics, Logger, etc.)
  • Meet tenets: (Yes/no)

Summary

Once the first message of Batch fails and we know it will be returned back to queue, rest of the messages with same message group id should no be processed

Motivation

We want to be complaint with the FIFO SQS principle and process messages within same group in order.

Proposal

If the processing of the batch message fails with retryable exception and message attributes contain message group id, then the id should be stored and subsequent message of batch should be checked against it. If there is a match, message processing should be skipped and message also returned to queue.

Drawbacks

As in FIFO queues, next messages of the same message group will be processed only when the failing was in removed from queue.

Rationale and alternatives

  • What other designs have been considered? Why not them?

  • What is the impact of not doing this?

Messages are not processed in order. Example: Lets say we have entity, which with id 1, and that ID is also message group ID. Now we have stack of updates in FIFO queue, first one updates value of entity to A, second one to value B. First one fails lets say on connection problem and will be retried later, second one succeeds and value is updated to B. Once the visibility timeout of first message expires, it will be processed again and value of entity with id 1 will be updated to A. Entity ends with invalid state.

Unresolved questions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions