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.

已提問 1 年前檢視次數 280 次
2 個答案
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
已回答 1 年前
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.

專家
已回答 1 年前
  • With standard queues this can happen. Maybe not a lot, but sure can.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南