Pause/resume queues with broadway

I have to open multiple queue ( I don’t know how many only at run time)
I want to be able to pause/resume a queue according to an external event, so suppose I have q1,q2 and q3
I want to to pause q3 but let the q1 and q2 run as usual
How do I do that


What do you mean by pause? Do you ever process it later? When? What happens with q4? Please try expanding on your scenario as much as possible, so we can better provide guidance. :slight_smile:

Thanks for your answer
The issue is this: My customers can open as many campaigns as they want. Every campaign can run on a specific date time. Every campaign has its own queue q-#{cmpid}
While the campaign is running it is sending sms messages to the contacts. The sms can be send from 8-10 in the morning. If the time is 10:00 it should stop sending the sms until next morning at 08:00
So, I want to be able to start the queue on 08:00 and pause at 10:00 and resume again next morning at 08:00

Hope it is clearer now :slight_smile:

1 Like

When Broadway starts, it starts a supervision tree, and you could shutdown the supervision tree at 10:00. So if you start something like Broadway.start_link(MyApp.Broadway, config), you can call Supervisor.stop(MyApp.Broadway) to stop it.

But if I will do that the other queue that start from 11:00 to 12:00 will not work

@ehayun did u finally figure out the solution to your problem?

Yes, but not with Broadway.
I believe it not supporting that yet
I use Oban for that


@ehayun So this could not be accomplished in Broadway?

Did u try @josevalim suggestion above? If yes, what difficulties did you face ?

I have more then one queue running at the same time.
I cant stop them all. I needed an option to stop a specific queue and then resume it.

You’re using only one topology. For Valim’s approach you need to run many of them.

edit: I misquoted, sry onkara