Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/saintedlama/amqp-jobs
- Owner: saintedlama
- License: isc
- Created: 2015-02-04T09:25:54.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T10:36:01.000Z (about 7 years ago)
- Last Synced: 2024-10-12T12:25:44.606Z (about 1 month ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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();
});
});```