Rocket04
Rocket04

Reputation: 1631

Scheduling SQS messages

My use case is as follows: I need to be able to schedule SQS messages in such a way that scheduled messages can be added to a queue on a specific date/time, and also on a recurring basis as needed.

At the implementation level, what I'm basically be looking to do is have some function I can call where I pass in the SQS queue, message, and schedule I want it to run on, without having to build the actual scheduler logic.

I haven't seen anything in AWS itself that seems to allow for that, I also didn't get the impression Lambda functions would do exactly what I need unless I'm missing something.

Is there any other third party cloud service for scheduled processes I should look into, or am I better off in the end just running a scheduling machine at AWS and have some REST API that can add cron jobs/windows scheduled tasks to it that will handle the scheduling of SQS messages?

Upvotes: 9

Views: 18963

Answers (3)

Chris Schuld
Chris Schuld

Reputation: 279

This is a completely selfish answer but I helped create a service for this need which may come in handy for others not on AWS or only adopting some AWS features called anticipated.io which allows you to do just that - schedule SQS. You can also schedule web hooks.

Upvotes: 0

user3524762
user3524762

Reputation: 642

It's now 2023, I use AWS EventBridge > Rules, you can add scheduled rules similar to cron for pushing messages onto the SQS queue.

https://us-west-2.console.aws.amazon.com/events/home?region=us-west-2#/rules

Upvotes: 3

stdunbar
stdunbar

Reputation: 17435

I could see two slightly different ways of accomplishing this, both based on Cloudwatch scheduled events. The first would be to have Cloudwatch fire off a Lambda. The Lambda would either have the needed parameters or would get them from somewhere else - for example, a DynamoDB table. Otherwise, the rule target allows you to specify a SQS queue - skipping the Lambda. But I'm not sure if that would have the configuration ability you'd want.

Either way, checkout Cloudwatch -> Events -> Create Rule in the AWS console to see your choices.

Upvotes: 13

Related Questions