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

preguntada hace un año1125 visualizaciones
2 Respuestas
1
Respuesta aceptada

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
EXPERTO
respondido hace un año
  • 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.

respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas