Steve Jobs
The Simple Jobs Queue That Just Works
Run scheduled tasks with Steve Jobs, the simple jobs queue made just for Meteor. With tight MongoDB integration and fibers-based timing functions, this package is quick, reliable and effortless to use.
- Jobs run on one server at a time
- Jobs run predictably and consecutively
- Jobs and their history are stored in MongoDB
- Failed jobs are retried on server restart
- No third party dependencies
The new 3.0 features repeating jobs and more improvements. It can run hundreds of jobs in seconds with minimal CPU impact, making it a reasonable choice for many applications. To get started, check out the documentation and the quick start below.
Developer Friendly GUI and API
In addition to a simple API, the Steve Jobs package offers an in-app development tool. After installing the main package, run the package command below and press Control + J in your app to open it.
meteor add msavin:sjobs-ui-blaze
Quick Start
First, install the package, and import if necessary:
meteor add msavin:sjobs
1import { Jobs } from 'meteor/msavin:sjobs'
Then, write your background jobs like you would write your methods:
1Jobs.register({ 2 "sendReminder": function (to, message) { 3 var call = HTTP.put("http://www.magic.com/sendEmail", { 4 to: to, 5 message: message 6 }) 7 8 if (call.statusCode === 200) { 9 this.success(call.result); 10 } else { 11 this.reschedule({ 12 in: { 13 minutes: 5 14 } 15 }); 16 } 17 } 18});
Finally, schedule a background job like you would call a method:
1Jobs.run("sendReminder", "jony@apple.com", "The future is here!");
One more thing: the function above will schedule the job to run on the moment that the function was called, however, you can delay it by passing in a special configuration object at the end:
1Jobs.run("sendReminder", "jony@apple.com", "The future is here!", { 2 in: { 3 days: 3, 4 }, 5 on: { 6 hour: 9, 7 minute: 42 8 }, 9 priority: 9999999999 10});
The configuration object supports date
, in
, on
, priority
, and data
, all of which are completely optional.
Documentation
Jobs.register
and Jobs.run
are all you need to get started, but that's only the beginning of what the package can do. To explore the rest of the functionality, jump into the documentation:
- Jobs.configure
- Jobs.register
- Jobs.run
- Jobs.execute
- Jobs.reschedule
- Jobs.replicate
- Jobs.start
- Jobs.stop
- Jobs.get
- Jobs.cancel
- Jobs.clear
- Jobs.remove
- Jobs.collection
Steve Jobs is an MIT-licensed project, brought to you by Meteor Candy.