Is it possible for dramatiq worker to auto shutdown if no messages are present in the queue?

290 Views Asked by At

I am running some dramatiq as kubernetes jobs. The usecase require the pods to shutdown if no messages are in the queue. So what I need is that the dramatiq worker process shutsdown if not messages are in the queue.

Is it possible to do that in dramatiq ?

1

There are 1 best solutions below

0
Roniel López On

you could use the @dramatiq.actor(max_retries=-1) decorator, that will result in the worker quitting once it has handled all of the messages in the queue