Search code examples
amazon-web-servicesaws-lambdamessage-queuemessagingamazon-sqs

Moderated messages on SQS


I have a messaging use case question.

We have a queue in AWS SQS, say, origQueue and out-of-the-box-lambda-based-message-consumption on that queue.

Now to cater to one particular feature of moderation based message consumption (on the basis of a 'isModerated' flag within the message), I am thinking to have another parallel queue (which would just be a moderated version of the above queue). On this 'moderated' queue, we don't want automatic consumption, rather we are looking for a moderated step trigger based consumption. That means any lambda will not be listening to this queue all the time.

One thought I had is to trigger a lambda at runtime (after moderation is done) which will basically de-queue from the moderated queue, remove the 'isModerated' flag from the messages and re-queue them in the actual queue, i.e. origQueue.

But before going that way, I just wanted to gather other potential ideas. Is there any out-of-the-box AWS feature or any pattern to solve this trigger based message consumption problem?


Solution

  • If the messages are entering the queue from SNS, you might be able to use message filtering before they get queued:

    https://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html