I have a Broadway pipeline, for some business reasons, isn’t a must this pipeline works all the time. So, some resources could be saved if the pipeline only works in a defined schedule.
I’m thinking of something like a feature flag with FunWithFlags but I’m unsure how to get this.
Other approach could be, instead of adding [MyBroadway, []] to the supervisor in application.ex, use schedules job to execute
Broadway.start_link(MyBroadway, config)
and
Broadway.stop(MyBroadway)
In this case, if I wanted to stop/resume it on demand (for some A/B testing maybe), I would have to enter the server and run the code manually in the remote console.
One option is to call GenStage.demand(producer, :accumulate) on each producer returned by Broadway.producer_name to stop and then call GenStage.demand(producer, :forward) when you want it to resume.