Bull: Allow to create a processor for a specific job name

Created on 12 Feb 2018  路  7Comments  路  Source: OptimalBits/bull

Description

Allow to create a processor in separate file (or server) for a specific job name in single queue.

Test code to reproduce

// producer.js

queue.add('foo', {});
queue.add('bar', {});
// worker-both.js
queue.process('foo', fooFunc)
queue.process('bar', barFunc)
// worker-only-foo.js
queue.process('foo', fooFunc)

The error Missing process handler for job type is raised in the worker-only-foo.js file.

Bull version

3.3.8

Additional information

I don't want to launch jobs with name bar on some servers but I'd like to launch jobs with both names on some servers.

Most helpful comment

it is not good

All 7 comments

Unfortunately that is not possible to achieve with current design, the workaround is to define 2 queues instead of only one.

it is not good

any solution except multiple queues?

you can use * for the job name and the the processor will catch all the jobs independently of names, I don't know if that is useful for you or not...

My task is:

// producer.js
queue.add('foo', {});
queue.add('bar', {});

Usual worker.

// worker-1.js
queue.process('*', fooFunc)

Worker to help with foo tasks.

// worker-2.js
queue.process('foo', fooFunc)

that will not work unfortunately with current queue design :/

Is this supported @manast.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thelinuxlich picture thelinuxlich  路  3Comments

alolis picture alolis  路  4Comments

sarneeh picture sarneeh  路  3Comments

JSRossiter picture JSRossiter  路  3Comments

pintocarlos picture pintocarlos  路  3Comments