How can I get Queue instance from Job?
- Dominant language
- JavaScript
- Stars
- 9.4k
- Forks
- 858
- PR merge metrics
- No merged PRs in 30d
Description
```javascript
# foobar.js
function foo(job, done) {
var queue = ?
queue.create("bar").save(); // where should this queue come from?
done()
}
function bar(job, done) {
console.log("hi");
done()
}
export {foo, bar}
```
```javascript
# app.js
var kue = require('kue')
, queue = kue.createQueue();
var {foo, bar} = require('./foobar.ts');
queue.process('foo', foo);
queue.process('bar', bar);
```
I want to seperate initiazation code and process code.
But then how can I get the queue instance in `foobar.js`?
Should I call `kue.createQueue` to get another singleton `Queue` instance? I expected that there's `Queue` instance in job's property, but it seems not.
What is the best way to do it?
Or can I just call annotated `bar` like python celery style?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the queue setup and processor registration in app.js, then inspect the job handlers in foobar.js and the Kue API documentation for how processors access or create queues. Done means identifying and documenting the supported way to enqueue a job from a processor, including whether a job exposes its queue or a separate queue instance is required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, developer-experience
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100