2.2.5 • Published 4 years ago

beanstalkd v2.2.5

Weekly downloads
589
License
MIT
Repository
github
Last release
4 years ago

node-beanstalkd-client

A low-level* beanstalkd client for Node.js. Inspired by the great work on fivebeans but updated to ES6 and promises.

* The client will handle connections and command request/responses, but does not setup everything required to run workers.

For a high level beanstalkd worker client, see node-beanstalkd-worker

Install

$ npm install --save beanstalkd

Usage

import Beanstalkd from 'beanstalkd';

const beanstalkd = new Beanstalkd(host, port);

beanstalkd.connect().then(function (beanstalkd) {
  // Verbosely put a new job
  beanstalkd.use(tube).then(function () {
    return beanstalkd.put(priority, delay, ttr);
  });

  // Or use fancy bluebird features
  beanstalkd.call('use', tube)
            .call('put', priority, delay, ttr);

  // Close when done
  beanstalkd.quit();
});

Commands

All beanstalkd commands are implemented per the protocol. Method names are the same as beanstalk command names camelCased, list-tubes-watched becomes listTubesWatched.

Extending

Beanstalkd.prototype.protocol|beanstalkd.protocol exposes the internal instance of beanstalkd-protocol used for command building and reply parsing.

Beanstalkd.addCommand(command, expectedResponse) lets you add new commands.

import Beanstald from 'beanstalkd';

Beanstalkd.prototype.protocol.addType('key', String);
Beanstalkd.prototype.protocol.addCommand('AUTH <key>\r\n');
Beanstalkd.prototype.protocol.addReply('OK\r\n');
Beanstalkd.prototype.protocol.addReply('AUTH_FAILED\r\n');
Beanstalkd.addCommand('AUTH', 'OK');

Debugging

Use DEBUG=beanstalkd* to enable verbose debugging.

2.2.5

4 years ago

2.2.3

4 years ago

2.2.4

4 years ago

2.2.2

5 years ago

2.2.1

6 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.0

7 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago