sails-hook-resque
v1.1.2
Published
Resque support for sails.js
Downloads
4
Maintainers
Readme
sails-hook-resque
Delayed tasks in Sails.js app. Using node-resque
Configuration
All configuration options are available in lib/defaults.js
Queue usage
Hook setup queue service in your Sails.js application
Your Sails.js application will contain sails.resque.queue
object that is NR.queue and have all it's methods.
Usage in application In your application:
Create a task in api/jobs/add.js
:
module.exports = {
plugins: [ 'jobLock' ],
pluginOptions: {
jobLock: {},
},
perform: function(a, b, callback){
setTimeout(function(){
var answer = a + b;
callback(null, answer);
}, 1000);
},
};
And queue it in your application:
sails.resque.queue.enqueue('math', 'add', [1, 2]);