Skip to content

simontabor/disque-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disque client

Dependencies Join the chat at https://gitter.im/simontabor/disque-client

NPM

This module is a relatively thin wrapper around the node_redis client to enable use of Disque.

Usage

var Disque = require('disque-client');

var disque = new Disque({
  servers: [
    {
      port: 7711,
      host: '127.0.0.1'
    }
  ]
});

disque.addjob("queue", "body", 0, function() {
  console.log(arguments);
});

Servers

Servers in the cluster will be automatically connected to (via the response of cluster nodes). Of course, to allow discovery there must be at least one server specified in the configuration.

Client creation

By default, clients will be created using Redis.createClient(port, host). This can be overridden by providing a function which must return a node_redis client. Clients are cached so only one connection will be made to each server.

var Disque = require('disque-client');
var RedisClient = require('redis');
var disque = new Disque({
  servers: [...],
  createClient: function(port, host) {
    // this is the default behaviour
    return RedisClient.createClient(port, host);
  }
});

About

Node.js Disque client built on top of node-redis

Resources

Stars

Watchers

Forks

Packages

No packages published