If instances of an application send ReceiveMessage request at the same time for SQS is it possible for them to receive the same message?

0

In SQS Standard Queues, if, let us say, 3 instances of the same application are running and cosuming messages from that queue (using long polling), if they send the ReceiveMessage request at the exact same time to SQS, is it possible for them to receive the same message? I'm not talking about at-least-once delivery. The application is idempotent, but I want to know if the MessageVisibilityTimeout guarantee that the scenario I described will not occur.

asked a year ago269 views
2 Answers
1

In a distributed system, race conditions can occur that make this possible, or better said, it is not impossible. Idempotency is the solution.

profile pictureAWS
answered a year ago
0

SQS was designed with the architecture you describe in mind - auto-scaled fleets of worker instances all consuming the same queue are a very common pattern. Receiving the same message is rare (I've never seen it when looking through logs); there's probably no guarantee though and this possibility is covered by the declared at-least-once delivery.

EXPERT
answered a year ago
  • With standard queues this can happen. Maybe not a lot, but sure can.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions