I am facing the problem of how to trigger a Lambda function after a message has been written in a SQS queue which is a SNS subscriber.
I know there is this useful post but I have not really understood how to publish a second message (on topic B) after the first one has been successfully sent (on topic A). I did not know if it is the right answer.
Here below there is a diagram of what I would link to implement
As you can see there is an API which publish to an SNS topic. The subscribers of this topic should be:
- An SQS queue where a message is stored
- A Lambda function which has to been triggered by SNS to consume the message written to the queue.
The problem I am facing is how to be sure the lambda is executed after a message has been written in the queue and how to really implement the solution. How to publish two topic and from one writing message in SQS and from the other one trigger the queue (how can be sure the message has been effectively written in the queue?).
Thank you very much guys, hope I was clear enough.