Fivebeans: различия между версиями

Материал из support.qbpro.ru
imported>Supportadmin
Нет описания правки
imported>Supportadmin
Строка 3: Строка 3:
[https://www.npmjs.org/package/fivebeans оригинал]
[https://www.npmjs.org/package/fivebeans оригинал]


==Creating a client==
===Creating a client===


The client constructor takes two arguments:
The client constructor takes two arguments:


host: The address of the beanstalkd server. Defaults to 127.0.0.1.
*host: The address of the beanstalkd server. Defaults to 127.0.0.1.
port: Port to connect to. Defaults to 11300.
*port: Port to connect to. Defaults to 11300.


The client emits three events that you should listen for: connect, error, and close.
The client emits three events that you should listen for: connect, error, and close.
Строка 31: Строка 31:
     })
     })
     .connect();</nowiki>
     .connect();</nowiki>
===Producing jobs===
===Consuming jobs===
===Server statistics===
==FiveBeansWorker==
===API===
====constructor====
===Events===
===Jobs===
===Handlers===
===Example===
==FiveBeansRunner==
===bin/beanworker===
===Configuration file===

Версия от 17:27, 11 мая 2014

beanstalkd client & worker daemon for node

оригинал

Creating a client

The client constructor takes two arguments:

  • host: The address of the beanstalkd server. Defaults to 127.0.0.1.
  • port: Port to connect to. Defaults to 11300.

The client emits three events that you should listen for: connect, error, and close.

The client is not usable until you call its connect() method. Here's an example of setting up a client:

var fivebeans = require('fivebeans');

var client = new fivebeans.client('10.0.1.1', 11300);
client
    .on('connect', function()
    {
        // client can now be used
    })
    .on('error', function(err)
    {
        // connection failure    
    })
    .on('close', function()
    {
        // underlying connection has closed
    })
    .connect();

Producing jobs

Consuming jobs

Server statistics

FiveBeansWorker

API

constructor

Events

Jobs

Handlers

Example

FiveBeansRunner

bin/beanworker

Configuration file