Can multiple Lambdas subscribe to SQS?

0

I've an SQS queue set up with multiple Lambdas configured as triggers. While this is allowed by AWS's it's not clear what the intended behavior is. For example, is one message pulled off the queue and sent to each Lambda? or only one lambda will get the message

Pascal
demandé il y a 7 mois939 vues
3 réponses
2

Only one of the functions will handle each message. If you want multiple functions to handle the messages, send them to SNS and then subscribe the different functions to the topic either directly, or using different queues. One queue per function.

profile pictureAWS
EXPERT
Uri
répondu il y a 7 mois
profile picture
EXPERT
vérifié il y a 7 mois
  • Thank You for sharing the details

0

Hi, Another possible pattern in your use case may be to trigger a Step Function from SQS and then have this Step Function orchestrate (parallel / sequential) the multiple lambdas if all of them need to run on each message.

See https://docs.aws.amazon.com/step-functions/latest/dg/sample-project-express-high-volume-sqs.html

The context of the Step Functions is a nice way to share the message across the various lambdas

Best,

Didier

profile pictureAWS
EXPERT
répondu il y a 7 mois
0

Another way to have multiple Lambda functions (or other subscribers) receive the same message is to use Kinesis instead of SQS. Note that the cost will likely be higher and there are lower throughput limits but depending on what you want to do it might be suitable.

profile pictureAWS
EXPERT
répondu il y a 7 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions