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

How exactly are we supposed to use QueueScheduler? #842

Closed
vprasanth opened this issue Oct 28, 2021 · 3 comments
Closed

How exactly are we supposed to use QueueScheduler? #842

vprasanth opened this issue Oct 28, 2021 · 3 comments
Labels
question Further information is requested

Comments

@vprasanth
Copy link

vprasanth commented Oct 28, 2021

First off, I love the tool ❤️

Unforntaly, for my life, I can't find either a good example or good docs to explain how we should be instantiating a QueueScheduler.

All I can tell is I must make one for any queue where I'd like failure/retry/backOff/etc to work. So often, I have code like this that looks odd:

export const SomeQueue = new Queue<JobData, JobResult>(SOME_QUEUE_NAME, {
   connection,
   defaultJobOptions,
});
// This is needed for retry and failure capture to work! Do no remove! 🚨 
>>> new QueueScheduler(SOME_QUEUE_NAME); <<<

I simply create an instance of QueueScheduler. That's it. It just feels like magic to me 😨

Is this normal?? Any feedback here would be helpful! ty!

@manast
Copy link
Contributor

manast commented Oct 29, 2021

I heavily recommend that you use typescript+vscode so you will get intellisense, with contextual documentation, etc. All objects in BullMQ follow the same pattern, first parameter is the queue name, second the options object. If no connection option is passed, then the default is connect to local redis, for example:

const queueScheduler = new QueueScheduler(QUEUE_NAME, { connection: { host: REDIS_HOST } })

@vprasanth
Copy link
Author

Does that mean I can use an instance of a QueueScheduler like a Queue? Like add a job or listen for events.

@manast
Copy link
Contributor

manast commented Oct 29, 2021

Here it is explained: https://docs.bullmq.io/guide/queuescheduler

@roggervalf roggervalf added the question Further information is requested label Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants