disque-client

0.1.0 • Public • Published

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);
  }
});

Dependents (0)

Package Sidebar

Install

npm i disque-client

Weekly Downloads

2

Version

0.1.0

License

MIT

Last publish

Collaborators

  • simontabor