I have configured a simple SQS and I want to process 4 messages at once. In my testing it had 2 "available" messages. When I receive the message, it only produces 1 at a time. What did i do wrong?
sqs = boto3.client('sqs') response = sqs.receive_message( QueueUrl=queue_url, MaxNumberOfMessages=4 )
You did nothing wrong and this behavior is normal.
This is due to the distributed nature of SQS (and most AWS services). Basically, not all nodes have all messages available, and the node you're talking to may return any number between 0 and MaxNumberOfMessages if any are available. To actually receive multiple messages in a single call, you would need to have 100 or 1000+ messages in the queue, and even then you might be out of luck and receive very few messages.
From Documentation: