Multiple consumers but 1 message in flight?

0

Hi,

I'm using this library (https://github.com/BBC/sqs-consumer) to consume messages from my queue. I have a small node app built that I'm running on my EC2 instance (using pm2 I do multiple npm start).

My expected outcome would be that there would be multiple messages in flight (I have 2 EC2 instances, 10 processes on each).

The actual outcome is that in the SQS dashboard I constantly see 1 message in flight.

My queue config

asked a year ago1089 views
2 Answers
1
Accepted Answer

You don't say whether you're specifying the MessageGroupId or not when sending the message so I'm going to assume for a moment that you're using a single group id.

Looking at the documentation for FIFO delivery logic what happens is that the ReceiveMessage call gets the number of messages you ask for (default is 1, maximum is 10) and then will not receive any more messages from the same group id until those message(s) have been deleted or are visible again. This is to ensure that messages are delivered in the correct order - which is what FIFO queues offer.

You can have multiple messages in flight if you use multiple group ids - but then ordering is only within the groups rather than the queue as a whole. Then you can have as many messages in flight (assuming you get one at a time) as you have unique group ids.

If ordering isn't important then a non-FIFO queue might be the way to go.

profile pictureAWS
EXPERT
answered a year ago
  • thank you, just as I realised this myself I saw your answer :)

0

Apologies, I'm not sure how to close the question. My mistake was that I was sending the same MessageGroupId for every message to this queue, when in fact I shouldn't have. This allows multiple processors to consume the queue.

answered a year ago

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