amqp-worker
A job queue backed by AMQP/RabbitMQ
Last updated 5 years ago by sakai135 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install amqp-worker 
SYNC missed versions from official npm registry.

node-amqp-worker

Codeship Status for sakai135/node-amqp-worker Code Climate Test Coverage David

Quick Start

var lib = require('amqp-worker');
var Client = lib.Client;
var Worker = lib.Worker;

var client = new Client('amqp://localhost');

var worker = new Worker('queue_name', function(msg, callback) {
  // do stuff with msg
  if (err) {
    // nack the message
    return callback(err);
  }

  // ack the message
  callback(null, result);
});

worker.on('complete', function(data) {
  // this worker's handler completed a message
  console.log(data);
});

client.addWorker(worker);

client.on('complete', function(data) {
  // a worker handler completed a message
  console.log(data);
});

client.connect(function() {
  console.log('workers started');
});

For more details, see the example.

Current Tags

  • 0.0.1                                ...           latest (5 years ago)

1 Versions

  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (1)
Dependents (3)

Copyright 2014 - 2016 © taobao.org |