[feat] Dynamic jobs
See original GitHub issueHi, is there a way to create a dynamic set of jobs? How can I pass custom parameters to a job? I was wondering if a similar approach to the following one can be used…
const currencies = ['USD', 'EUR','GBP'];
const currencyJob = currency => () => {
// job
console.log(currency)
};
const jobs = currencies.map(currency => ({task: currencyJob(currency), interval: '2m'}));
const bree = new Bree({jobs});
// start...
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Dynamic Industries Jobs, Employment in Louisiana | Indeed.com
Dynamic Industries jobs in Louisiana. 1,209 jobs. Cable Installation Technician. DCOMM, INC2.2. Alexandria, LA. $800 - $1,300 a week. Full-time +1.
Read more >getsentry/sentry@884f9bf · GitHub - feat(dynamic-sampling)
Developer-first error tracking and performance monitoring - feat(dynamic-sampling): Improve log styling · getsentry/sentry@884f9bf.
Read more >The Ultimate Guide to Dynamic Work | Okta
A Dynamic Work model allows employees, partners, and contractors to work wherever, whenever, and however they want. We launched Dynamic Work as a...
Read more >Dynamic Sports Development Careers - AngelList
Dynamic Performance Insoles are the only product to provide active support , cushion, and gait control in one insole. Featuring FLEX ARCH patent...
Read more >Dynamic Work | Spotify
Listen to Dynamic Work on Spotify. Artist · 30 monthly listeners. ... Featuring Dynamic Work. Dynamic Work Radio. Fans also like. In-Motion. Jobeth....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tamaker When you create a task you need to specify also the
workerData
property.Considering the case above you can retrieve those properties from your job (
task1.js
) using worker threads.See https://nodejs.org/api/worker_threads.html#worker_threads_worker_workerdata
I did notice the following method when I was looking for an example (2 mins ago)… Check => https://github.com/breejs/bree#using-functions-for-jobs So, it seems you can specify a function… I didn’t even noticed that when I was reading the docs… my bad 😃
So currently you might have 2 ways to do it…
@corzani Can you share a rough example of how you’re achieving this? I’m exploring options along the same lines as your approach. Thanks!