One SQS message, several handlers

Hey there,

is it possible to publish a message in SQS and have several handlers subscribe to this message? If the answer is yes, are there examples?

Thanks

Have not tried to do so yet, but do assume you could. You would just subscribe the handlers/functions to the same Queue in the “events” section of your yaml file.

I assume you could follow one of these setups to get you started. I believe you could just use the same queue name in the events area I would expect.

I’m thinking something like below: You could use different Queue Subscription methods though.

functions:
  compute:
    handler: handler.compute
    events:
      - sqs: arn:aws:sqs:region:XXXXXX:MyFirstQueue
   
  add:
    handler: handler.add
    events:
      - sqs: arn:aws:sqs:region:XXXXXX:MyFirstQueue
1 Like

Yes yes, that actually works. Thanks!