bull
bull copied to clipboard
Give ability to disable job processing in `BullModule.forRoot` method
Is there an existing issue that is already proposing this?
- [X] I have searched the existing issues
Is your feature request related to a problem? Please describe it
In our architecture, we have two types of "applications", that share the same code:
- web servers: serve clients requests
- workers: process bullmq jobs
We would like to be able disable job processing on some instances only.
Describe the solution you'd like
In BullModule.forRoot
method, have a disabled
prop, to disable the processing of jobs on this instance.
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
Be able to easily disable processing.
What about not importing BullModule.forRoot
in the context of a web server application?
@kamilmysliwiec will the web server still be able to produce messages if BullModule is not initialised at all?
@kamilmysliwiec sorry I didn't notice your answer, the concern is as @jarPotato states it that I still want to be able to send messages, I just want to disable the processing.
Currently our workaround is that we gathered all listeners/processors classes in a single module, that is imported conditionally based on an environment variable.
The issue with this pattern is that it's quite easy to accidentally import a listener/processor in the wrong module (or fail to catch this in a review), and thus have the wrong instances (web instead of workers) process the jobs.
Same here. Seems like a pretty standard use-case. I've done something similar (set concurrency to 0 based on an Env var), it's got the same drawback as the above approach. Keen to get this built into Nest/Bull