user299709
user299709

Reputation: 5412

celery: how to count total number of messages in a queue every interval?

I want to monitor a queue to be notified when it becomes empty. To do this I need to find out how many messages are in the queue and this task needs to run every interval ex. every 15 seconds.

I am confused reading the docs which say that you shouldn't use celerybeat in a worker for production, so does this mean I need to create a separate python script that utilizes periodic tasks? Not sure how I can implement this.

Upvotes: 3

Views: 2314

Answers (1)

Chillar Anand
Chillar Anand

Reputation: 29524

You can retrieve number of messages in a queue using this answer.

For beat, you can always start a new process using

celery beat

If you don't want to use beat at all, you can schedule a cron job which will do that for you.

Upvotes: 1

Related Questions