Skip to content

Salakar/disqueue-node

 
 

Repository files navigation

disqueue-node client

Build StatusDependency StatusCode ClimateStories in Ready

This is a Disqueue client using node.js.

Setup

Install Disque

How to use

Connect to disqueue then you can use the connected disqueue( examples )

API

ADDJOB

disqueue.addJob( {
 'queue', <queue>,
 'job' : <job>,
 'timeout' : <ms-seconds>, // optional defaults to 0
 'replicate' : <count>, // optional
 'delay' : <seconds>, // optional
 'retry' : <seconds>, // optional
 'ttl'   : <seconds>, // optional
 'maxlen' : <count>, // optional
 'async' : <true> // optional
}, callback )

GETJOB

disqueue.getJob( {
 'queue', <queue>, // can be a string or an array of queues
 'count' : <count>,
 'nohang' : <true> // Optional defaults to false
}, callback )

FASTACK

disqueue.fastAck( <ARRAY of IDS|STRING of the ID>, callback );

ACKJOB

disqueue.ackJob( <ARRAY of IDS|STRING of the ID>, callback );

Authentication

To connect to disque just add password

'use strict';

var options = {
 'auth' : {
  'password' : 'gideonairex'
 }
};

var disqueue = new Disqueue( options );

diqueue.on( 'connected', function () {
} );

Or you just add options and use the default port and host

'use strict';

var options = {
 'host' : '127.0.0.1',
 'port' : 7777,
 'auth' : {
  'password' : 'gideonairex'
 }
};

var disqueue = new Disqueue( options );

diqueue.on( 'connected', function () {
} );

Usage

'use strict'

var Disqueue = require( 'disqueue-node' );
var disqueue = new Disqueue();
diqueue.on( 'connected', function () {
 disqueue.addJob( {
  'queue' : 'test',
  'job' : 'hello world'
 }, function ( error, addJobResult ) {
 } );
} );

Test

npm test
npm run lint

Todo

  1. Complete all commands
  2. Benchmark

About

node client for disqueue

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.5%
  • Shell 0.5%