Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/saintedlama/amqp-jobs

Minimalist abstraction layer for amqp jobs implementations
https://github.com/saintedlama/amqp-jobs

Last synced: about 15 hours ago
JSON representation

Minimalist abstraction layer for amqp jobs implementations

Awesome Lists containing this project

README

        

# amqp-pubsub
Minimalist abstraction layer for amqp jobs implementations.

**This repository is not maintained anymore**

## Installation

```
npm install amqp-jobs
```

## Usage

Queue work items

```javascript

var amqp = require('amqp');
var jobs = require('../');

var connection = amqp.createConnection({ host: "localhost" });

connection.on('ready', function() {
var job = jobs(connection, 'amqp-jobs-example');

job.queue({ text : 'hello world' });
});

```

Worker

```javascript

var amqp = require('amqp');
var jobs = require('../');

var connection = amqp.createConnection({ host: "localhost" });

connection.on('ready', function() {
var job = jobs(connection, 'amqp-jobs-example');

var generateError = false;

job.worker(function(message, next) {
// Do the work. Call next without err to acknowledge msg or pass an error do not acknowledge message
next();
});
});

```