Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/titarenko/evque
AMQP-based event bus.
https://github.com/titarenko/evque
Last synced: about 1 month ago
JSON representation
AMQP-based event bus.
- Host: GitHub
- URL: https://github.com/titarenko/evque
- Owner: titarenko
- Created: 2015-12-10T15:40:25.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-06-21T09:31:55.000Z (over 6 years ago)
- Last Synced: 2024-12-01T04:04:34.375Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 45.9 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# evque
AMQP-based event bus.
[![Build Status](https://secure.travis-ci.org/titarenko/evque.png?branch=master)](https://travis-ci.org/titarenko/evque) [![Coverage Status](https://coveralls.io/repos/titarenko/evque/badge.png)](https://coveralls.io/r/titarenko/evque)
## Installation
```bash
npm i evque --save
```## Description
Each `event` = `exchange` of `fanout` type, named after event.
Each `subscriber` = `queue` bound to `exchange`, named after event and subscriber.
![Diagram](diagram.png)
## Motivation
- simple project bootstrap
- events are preserved across broker restarts
- events will wait for their listeners (will not disappear if listener is offline)## Example
```js
var bus = require('evque')('amqp://localhost');bus.on('error', function (ev) {
console.log(
'listener %s failed to handle event %s (%j) due to %s',
ev.listener, ev['event'], ev.data, ev.error.stack
);
});bus.on('connection-error', function () {
console.log('connection closed by RabbitMQ. Restart your app?');
});bus.subscribe('event1', 'listener1', function (data) {
console.log('listener1 received event1 (%j)', data);
});bus.subscribe('event1', 'listener2', function (data) {
console.log('listener2 received event1 (%j)', data);
});bus.publish('event1', { a: 'b' });
```## License
MIT