I had a similar question and I basically came up with the following. If anyone else has a different solution I would love to see some other ideas.
var jobQueue = kue.createQueue();
// Define job processor
jobQueue.process('thursday-jobs', function (job, done) {
var milisecondsTillThurs = // TODO: Get the time until next thursday. For this I used moment.js
// do this job again next Thursday
jobQueue.create('thursday-jobs').delay(milisecondsTillThurs).save();
// For Example purpose this job waits then calls done
setTimeout(function () {
done();
}, 10000);
});
// Use some initialization code to check if the job exists yet, and create it otherwise
kue.Job.rangeByType('thursday-jobs','delayed', 0, 10, '', function (err, jobs) {
if (err) {return handleErr(err);}
if (!jobs.length) {
jobQueue.create('thursday-jobs').save();
}
// Start checking for delayed jobs. This defaults to checking every 5 seconds
jobQueue.promote();
});
Kue has minimal documentation, but the source is well commented and easy to read