
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
taskscheduler
Advanced tools
A simple, queue-backed and topic-oriented task scheduler for Node.js with pluggable queue implementation.
For a sample queue plugin that uses Amazon SQS, see: SQSTask
A simple call:
scheduler.addTopicHandler(sometopic, taskJob, 100);
will schedule a javascript function (taskjob in this case) that can "listen" to incoming messages on a sometopic topic
in a queue every 100 milliseconds. A taskjob implementation receives: (topic, message, callback) arguments when called. A 'topic' is typically
a separate queue/channel on a message queue.
You can send messages asynchronously to the queue with:
scheduler.message( sometopic
, somemessage
, function(err, result) {
if (err) {
// handle error
}
});
An early release. Feel free to: inspect, hack, enjoy and contribute (e.g.: feedback, documentation or bug fixes), but consider it an "alpha" stability.
> npm install taskscheduler
> npm install sqstask
Before you can use taskscheduler you have to configure it:
var AWSConfig = {
"accessKeyId" : "..."
, "secretAccessKey" : "..."
, "awsAccountId" : "..."
};
var util = require('util')
, sqstask = require('sqstask')(AWSConfig)
, scheduler = require('taskscheduler')(sqstask);
var publisherHandlerID = scheduler.addTopicHandler("publisher", taskJob, 100);
function taskJob(topic, message, callback) {
console.dir("Task job fired, with message: " + message);
var err = null;
var random = Math.floor(Math.random() * 5) + 1;
if (random === 5) {
err = new Error("something");
console.log("Error simulated for message: " + message);
}
callback(err);
};
//-- You can also de-register a task, if you don't want it running "forever".
setTimeout(function(hID) {
scheduler.removeTopicHandler(hID);
}, 1000, publisherHandlerID);
scheduler.topicEnsureExists(test_topic, function(err) {
if (!err) {
sendmessagesAndReadMessages();
} else {
console.dir(err);
}
}); // end of topic ensuring.
function sendmessagesAndReadMessages() {
for (var i = 0; i<5; i++) {
scheduler.message( "publisher"
, "This is message # " + new Date().getTime()
, function(err, result) {
if (err) {
util.log("Error sending a message to the queue: " + util.inspect(err.Body.ErrorResponse.Error));
console.log(err);
}
});
}
}
To implement a plugin for a different queue, you must write a proper Node.js module that complies to the following requirements:
For a sample of a properly implemented queue task, inspect the source code of SQSTask
FAQs
Task Scheduler
We found that taskscheduler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.