iammrmehul
iammrmehul

Reputation: 820

Lambda batch processing of SQS messages from multiple queues

I have a lambda setup that has event source configured with 5 different SQS queues. Now, if the batch size of the lambda is configured to be 10, will the 10 records in SQSEvent in the lambda handler will be from the same queue or can the 10 records in the batch be from any of the 5 queues ?

Upvotes: 2

Views: 1187

Answers (1)

jarmod
jarmod

Reputation: 78842

The behavior is undocumented, but it's almost certainly the case that the Lambda service will batch events from one, and only, queue in a single Lambda invocation.

That said, if it's critical to your application that you be able to distinguish one queue source from another, then either:

  1. create one Lambda handler per queue (it could simply call your common handler function with an indicator of which queue was the source), or
  2. check the value of the eventSourceARN in each record in the event

Upvotes: 1

Related Questions