Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

Minimalist abstraction layer for amqp publish/subscribe implementations
https://github.com/saintedlama/amqp-pubsub

Last synced: about 15 hours ago
JSON representation

Minimalist abstraction layer for amqp publish/subscribe implementations

Awesome Lists containing this project

README

        

# amqp-pubsub
Minimalist abstraction layer for amqp publish/subscribe implementations

## Installation

```
npm install amqp-pubsub
```

## Usage

Publisher

```javascript
var amqp = require('amqp');
var pubsub = require('amqp-pubsub');

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

connection.on('ready', function() {
var pubsubClient = pubsub(connection, 'amqp-pubsub-example');
pubsubClient.publish({ test : 'hello world'});
});

```

Subscriber

```javascript
var amqp = require('amqp');
var pubsub = require('../');

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

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

pubsubClient.subscribe(function(message) {
console.log(message);
});
});

```