-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Processing jobs in microservice setup #1481
Comments
Looks good, however you cannot use named processors like that, you will need to define the 2 processors in every processor instance, so I think you should better use 2 queues, one for the alarms and one for the fetcher. |
Thanks @manast for your response.
I am not clear with the above. |
Hi! This is because both workers use the same queue. Worker tries to get next job from queue, receives a job with wrong type (eg "fetcher" instead of "processor") and fails because it knows how to handle "processor" and doesn't know what to do with "fetcher". Bull doesn't allow you to take only compatible jobs from queue, both workers should be able to process all types of jobs. The simplest solution would be to use two different queues, one for processors and one for fetchers. Then you can remove names from jobs and processors, it won't be needed anymore since name is defined by the queue. |
Thanks @stansv. Understood the queue mechanism now. |
This should be in upper case with some blinking in the documentation. |
Description
I would like to process scheduled jobs using node.js bull. Basically I have two processors that handle 2 types of jobs. There is one configurator that configures the jobs which will be added to the bull queue using cron.
The scheduler will be in one microservice and the each of the processor will be a separate microservice. So I will be having 3 micro services.
My question is am I using the correct pattern with bull?
Minimal, Working Test code to reproduce the issue.
index.js
processor-configurator.js
fetcher-configurator.js
fetcher.js
alert-processor.js
There will be three microservices -
With this setup, sometimes I am getting the error Missing process handler for job type
(An easy to reproduce test case will dramatically decrease the resolution time.)
Bull version
3.10.0
Additional information
Note that I have posted this question in StackOverflow. But I don't see a lot of questions on bull.js over there. So I am reposting it here.
The text was updated successfully, but these errors were encountered: