Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 736
Rocket04 Avatar asked Sep 11 '17 19:09

Rocket04


People also ask

Can we set priority in SQS?

Priority: Use separate queues to provide prioritization of work. Scalability: Because message queues decouple your processes, it's easy to scale up the send or receive rate of messages — simply add another process. Resiliency: When part of your system fails, it doesn't need to take the entire system down.

Does Amazon SQS provide message ordering?

Q: Does Amazon SQS provide message ordering? Yes. FIFO (first-in-first-out) queues preserve the exact order in which messages are sent and received. If you use a FIFO queue, you don't have to place sequencing information in your messages.

What will happen if you set the Amazon SQS message timer?

Message timers let you specify an initial invisibility period for a message added to a queue. For example, if you send a message with a 45-second timer, the message isn't visible to consumers for its first 45 seconds in the queue.


1 Answers

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.

like image 117
stdunbar Avatar answered Sep 23 '22 07:09

stdunbar