Skip to content
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

Accept/reject jobs by job name? #84

Closed
kevinejohn opened this issue Dec 10, 2019 · 7 comments
Closed

Accept/reject jobs by job name? #84

kevinejohn opened this issue Dec 10, 2019 · 7 comments

Comments

@kevinejohn
Copy link

Is there a way to make a worker not accept and process a job based on the job name? This would be if you have specific workers that process different job names but use the same queue instead of creating completely separate queues.

It seem like this is possible from the readme example but it doesn't function that way:

const worker = new Worker('Paint', async job => {
  if (job.name === 'cars') {
    await paintCar(job.data.color);
  }
});

https://github.com/taskforcesh/bullmq#the-gist

@manast
Copy link
Contributor

manast commented Dec 10, 2019

I think we can improve the documentation. We want to get rid from legacy bull way of handling named jobs which was actually confusing people. So the answer to your question is no, you need to handle all the job "names" in your processor.

@frct1
Copy link

frct1 commented Jan 24, 2020

@manast
Hi
But what is will be proper way to handle specified jobs and add processors without a lot of boilerplate "if-based" code ?

@phrozen
Copy link

phrozen commented Feb 14, 2020

Can we confirm what is job.name doing in 4.0?

@ccollie
Copy link
Contributor

ccollie commented Apr 19, 2020

ping. I'm writing a management app and supporting job.name adds a bit of complexity which I'm happy to deal with only if this feature is useful and being officially supported going forward.

@manast
Copy link
Contributor

manast commented Apr 19, 2020

job.name is just a convenience attribute that can be used for UIs, tools, or whatever. But there are no other magic things happening behind the curtains with the name attribute.

@ccollie
Copy link
Contributor

ccollie commented Apr 19, 2020

Understood. I just wanted to make sure that this attribute is a stable part of the api.

@roggervalf
Copy link
Collaborator

This should be covered in our documentation https://docs.bullmq.io/patterns/named-processor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants