sqs-taskqueue icon indicating copy to clipboard operation
sqs-taskqueue copied to clipboard

A drop-in replacement for Kue with Amazon SQS backend

trafficstars

SQS Task Queue

Build Status Code Climate Test Coverage

Are you using Kue with Redis backend?

This a quick way to replace Kue with Amazon SQS backend.

Instead of:

var kue = require('kue'),
	queue = kue.createQueue();

Do like this:

var AWS = require('aws-sdk')
var sqs = new AWS.SQS({
  region: '',
  accessKeyId: '',
  secretAccessKey: ''
})

var SQSWorker = require('sqs-taskqueue'),
  queue = new SQSWorker(
    sqs,
    'https://sqs.ap-northeast-1.amazonaws.com/XXXXXXXXXX/',
    'yourapp'
  );

The rest they are the same!!!

For example:

var job = queue.create('email', {
    title: 'welcome email for tj'
  , to: '[email protected]'
  , template: 'welcome-email'
}).save( function(err){
   if( !err ) console.log( job.id );
});