Hardy
Hardy

Reputation: 1539

how to run task at scheduled time with RabbitMQ

I'm using RabbitMQ to make my tasks pool run sequentially one by one. But how can add a time parameter to make a task only run at the defined time in the future (like a scheduled tasks).

Upvotes: 17

Views: 33040

Answers (3)

Hamid Mohayeji
Hamid Mohayeji

Reputation: 4285

RabbitMQ has a plugin for delayed messages.

Using this plugin, the messages can be delivered to the respective queues after a certain delay. Thanks to this plugin, you can use RabbitMQ as a scheduler, even though it's not a task scheduler by nature.

Upvotes: 5

Jenish
Jenish

Reputation: 588

You can use celery along with rabbitmq as broker for task scheduling. Here is the celery documentation http://docs.celeryproject.org/en/master/index.html

Upvotes: 2

millerdev
millerdev

Reputation: 10331

RabbitMQ is not a task scheduler, even though the documentation talks about "scheduling" a task. You might consider using something like cron. You could also use a library like sched to build a scheduler in a Python process.

FYI It looks like this question has already been answered: Delayed message in RabbitMQ

Upvotes: 8

Related Questions