A simple jobs queue that just works [Meteor.js]
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
package Minor patch before publication Jun 24, 2018
tests
CHANGES.md Updated documentation for 3.0 Jun 24, 2018
DOCUMENTATION.md Update DOCUMENTATION.md Sep 27, 2018
GUI.png
ICON.png
LICENSE.md
PATENTS.md
README.md

README.md

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
import { Jobs } from 'meteor/msavin:sjobs'

Then, write your background jobs like you would write your methods:

Jobs.register({
    "sendReminder": function (to, message) {
        var call = HTTP.put("http://www.magic.com/sendEmail", {
            to: to,
            message: message
        })

        if (call.statusCode === 200) {
            this.success(call.result);
        } else {
            this.reschedule({
                in: {
                    minutes: 5
                }
            });
        }
    }
});

Finally, schedule a background job like you would call a method:

Jobs.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:

Jobs.run("sendReminder", "jony@apple.com", "The future is here!", {
    in: {
        days: 3,
    }, 
    on: {
        hour: 9,
        minute: 42
    },
    priority: 9999999999
});

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:


Steve Jobs is an MIT-licensed project, brought to you by Meteor Candy.