-
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
Get job return value #214
Comments
I think I understand your use case. In my opinion you should not use bull for a case like this. The pattern described in the README is decoupling the service that puts a job into the queue from the service that handles the completion of the job. I don't know the details of what you are trying to do, but in the case you want to notify a job status to the client that requested the job you could also use redis pubsub mechanism, and websocket communication to update progress or status of a job. I dont think it is a good idea to keep a http request idling while bull is processig a job. |
@manast Ok I understand, thanks for the response. In my use case the processing takes about 0.5 - 5 seconds and I would like to make the API for the user as easy as possible. So implementing it as a "blocking" HTTP call, should be fine in this case. I have separate workers so I'll be able to scale the workers independently from the web instances. |
Same issue, any solution? |
For those who land here from Google: Bull 3.0.0. RC 4 added support for the glorious |
It took me four hours to find here. |
To be a little bit more clear (since it looks like it's missing in the bull docs),
|
I have the following setup, where I use bull as the job/message queue using this pattern which you have documented and recommended in other issues. I have one problem which I haven't been able to solve.
Data flow:
Queue('worker')
e.g. jobId 2Queue('server')
. The response "job" is just a message. It has a different jobId, e.g. 3I wasn't able to implement the described scenario with the recommended two queues approach. I would need something more from the API. A few possibilities:
Provide a
job.on('completed')
API. Then the instance which is creating the job, could listen the completion event and respond the result back as a HTTP response.Provide a way to "wait or get" a completed job with a
data
filter. For example:Other relevant issues which directly didn't answer my problem: #11, #178, #209
If you think the newest 0.7.0 release resolves this problem, could you explain how the API works? I can also help to document the usage to readme.
The text was updated successfully, but these errors were encountered: