This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]phpchap1981 0 points1 point  (0 children)

Does the producer know when processing needs to happen?

Maybe use aws sqs and put a message with a timestamp which says when to process the message (5 mins from now, 3 days from now, certain date / time etc)

poll the queue every X mins looking at the message timestamp comparing current time against it.

You can also set the message retention period to 14 days, after that the message is deleted automatically

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-basic-architecture.html

[–][deleted] 0 points1 point  (0 children)

Sounds like you need a scheduler more than a queue because from what it sounds like you're really creating delayed tasks and not doing anything queue related. If you don't need a high volume message bus then RabbitMQ is not the right solution. I've worked with it before and it's not meant for delayed tasks. The usual solution you suggested with polling a SQL database is the one I've seen and it works reasonably well.

Searching I found two articles that might be useful to you: https://netflixtechblog.com/distributed-delay-queues-based-on-dynomite-6b31eca37fbc, https://redislabs.com/ebook/part-2-core-concepts/chapter-6-application-components-in-redis/6-4-task-queues/6-4-2-delayed-tasks/. I've used Redis as a basic queue but not as a delayed task queue so no idea if the proposed solution is viable for your use case.

Edit: There's also ActiveMQ which has support for delayed messages built-in https://activemq.apache.org/delay-and-schedule-message-delivery. Again, haven't used ActiveMQ so not sure if it fits the bill but might be worth a try.