Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcollina/mqemitter-mongodb
MongoDB based MQEmitter
https://github.com/mcollina/mqemitter-mongodb
Last synced: about 13 hours ago
JSON representation
MongoDB based MQEmitter
- Host: GitHub
- URL: https://github.com/mcollina/mqemitter-mongodb
- Owner: mcollina
- License: mit
- Created: 2014-10-25T11:26:12.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-02-11T16:49:49.000Z (9 months ago)
- Last Synced: 2024-11-01T12:42:21.770Z (8 days ago)
- Language: JavaScript
- Size: 63.5 KB
- Stars: 18
- Watchers: 4
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - mcollina/mqemitter-mongodb - MongoDB based MQEmitter (JavaScript)
README
mqemitter-mongodb [![Build Status](https://travis-ci.org/mcollina/mqemitter-mongodb.png)](https://travis-ci.org/mcollina/mqemitter-mongodb)
=================MongoDB powered [MQEmitter](http://github.com/mcollina/mqemitter).
See [MQEmitter](http://github.com/mcollina/mqemitter) for the actual
API.[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard)
Install
-------```bash
$ npm install mqemitter-mongodb --save
```Example
-------```js
var mongodb = require('mqemitter-mongodb')
var mq = mongodb({
url: 'mongodb://127.0.0.1/mqemitter?auto_reconnect'
})
var msg = {
topic: 'hello world',
payload: 'or any other fields'
}mq.on('hello world', function (message, cb) {
// call callback when you are done
// do not pass any errors, the emitter cannot handle it.
cb()
})// topic is mandatory
mq.emit(msg, function () {
// emitter will never return an error
})
```API
-----
### MQEmitterMongoDB([opts])Create a new instance of mqemitter-mongodb.
Options:
* `url`: a mongodb endpoint url
* `database`: a mongodb database name, by default it comes from the uri
* `mongo`: options for mongodb client
* `db`: a db instance of mongodb (instead of url)Acknowledgements
----------------Code ported from [Ascoltatori](http://github.com/mcollina/ascoltatori).
License
-------MIT