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

Infinite job #92

Closed
ScreamZ opened this issue Feb 19, 2021 · 1 comment
Closed

Infinite job #92

ScreamZ opened this issue Feb 19, 2021 · 1 comment

Comments

@ScreamZ
Copy link

ScreamZ commented Feb 19, 2021

Hello,

I'm trying to play with bree, thanks for this tool.
I've read #17 and I'm wondering how can I achieve my use case.

I understand the logic besides polling interval on some jobs that accepts some kind of delay, like a minute or more.
I'm trying to use Bree as a job processor somehow like agenda with retry.

Lemme explain a simple use case.

I create users in my system. Then I "emit" some kind of event, whether in a specific collection or just by creating the user document let's say in MongoDB.

In the meantime, when the application starts, I would like to have one job, to start and use a change stream (https://docs.mongodb.com/drivers/node/usage-examples/changeStream/#:~:text=You%20can%20watch%20for%20changes,event%20documents%20when%20they%20occur.) that would process docs

I just need to bree.start and bree.run("jobX") ?

Thanks

@shadowgate15
Copy link
Member

This should work as long as your worker doesn't stop, i.e. you have some sort of infinite loop running, likely via setInterval.

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

No branches or pull requests

2 participants