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

질문됨 일 년 전1123회 조회
2개 답변
1
수락된 답변

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
전문가
답변함 일 년 전
  • 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.

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠