thunks/thunk-disque

Name: thunk-disque

Owner: thunks

Description: A thunk/promise-based disque client.

Created: 2015-04-28 00:23:49.0

Updated: 2018-04-21 16:25:42.0

Pushed: 2017-10-15 13:10:35.0

Homepage: null

Size: 67

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

thunk-disque

A thunk/promise-based disque client, support all disque features.

NPM version Build Status Downloads js-standard-style

Features
???? http://disquebook.com/
https://github.com/antirez/disque
https://github.com/thunks/thunks
Installation

Node.js:

install thunk-disque
Demo
disque = require('thunk-disque')
client = disque.createClient([7711, 7712, 7713])
clientP = disque.createClient([7711, 7712, 7713], {usePromise: true})

hunk API
nt.info()(function (err, info) {
nsole.log(err, info)

turn this.addjob('queueA', 'Hello', 0)
unction (err, res) {
nsole.log(err, res)
 null
 'DI81250b3ccbac68e6625e79c8e7c5b286b1dcd2ac05a0SQ'
turn this.show(res)

unction (err, res) {
nsole.log(err, res)
 null
 {
   id: 'DI81250b3ccbac68e6625e79c8e7c5b286b1dcd2ac05a0SQ',
   queue: 'queueA',
   state: 'queued',
   repl: 3,
   ttl: 86400,
   ctime: 1430579357544000000,
   delay: 0,
   retry: 8640,
   'nodes-delivered':
    [ 'f0e652056250c887ed294a53fa9386ea05abb0be',
      '2067c69f914c619ed9f348f5ce6e7532ec26e9a8',
      '81250b3c4318f0b6463da3742c7cf7069a46b6f6' ],
   'nodes-confirmed': [],
   'next-requeue-within': 8639835,
   'next-awake-within': 8639335,
   body: 'Hello'
 }
turn this.clientEnd()


romise API
ntP.info()
hen(function (info) {
console.log(info)

return clientP.addjob('queueA', 'Hello', 0)

hen(function (res) {
console.log(res)
// 'DI81250b3ccbac68e6625e79c8e7c5b286b1dcd2ac05a0SQ'
return clientP.show(res)


hen(function (res) {
console.log(res)
// {
//   id: 'DI81250b3ccbac68e6625e79c8e7c5b286b1dcd2ac05a0SQ',
//   queue: 'queueA',
//   state: 'queued',
//   repl: 3,
//   ttl: 86400,
//   ctime: 1430579357544000000,
//   delay: 0,
//   retry: 8640,
//   'nodes-delivered':
//    [ 'f0e652056250c887ed294a53fa9386ea05abb0be',
//      '2067c69f914c619ed9f348f5ce6e7532ec26e9a8',
//      '81250b3c4318f0b6463da3742c7cf7069a46b6f6' ],
//   'nodes-confirmed': [],
//   'next-requeue-within': 8639835,
//   'next-awake-within': 8639335,
//   body: 'Hello'
// }

atch(function (err) {
console.error(err)

API
disque = require('thunk-disque')
disque.createClient([port], [host], [options]) disque.createClient([addressArray], [options])

Create a disque client, return the client.

onnect to 127.0.0.1:7711
client1 = disque.createClient()
client2 = disque.createClient(7711, '127.0.0.1')

onnect to 127.0.0.1:7711, 127.0.0.1:7712
nd auto meet them into cluster
client3 = redis.createClient([7711, 7712], {autoMeet: true})
client4 = redis.createClient(['127.0.0.1:7711', '127.0.0.1:7712'], {autoMeet: true}) // IPv4
client5 = redis.createClient(['[::1]:7711', '[::1]:7712'], {autoMeet: true}) // IPv6
disque.log([…])
client = disque.createClient()
nt.info()(redis.log)
Events
client.on('close', function () {}) client.on('connect', function () {}) client.on('connection', function (connection) {}) client.on('warn', function (error) {}) client.on('error', function (error) {}) client.on('reconnecting', function (message) {}) client.on('monitor', function (message) {})
Others
client.clientCommands client.clientEnd() client.clientUnref()
Disque Commands
client.ackjob client.addjob client.auth client.bgrewriteaof client.client client.cluster client.command client.config client.debug client.deljob client.dequeue client.enqueue client.fastack client.getjob client.hello client.info client.latency client.loadjob client.monitor client.ping client.qlen client.qpeek client.show client.shutdown client.slowlog client.time

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.