0.1.5 • Published 6 years ago

mongo-microservice v0.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

mongo-microservice

Opinionated Node microservice/worker base intended to utilized MongoDB + RabbitMQ

Usage

let Service = require('mongo-microservice');
const QUEUE_NAME = 'example';
class ExampleService extends Service {

  constructor (config) {
    super(process.env.mongoUri, process.env.rabbitUri);
    this.addQueues([{name: QUEUE_NAME, handler: this._handleExample}]);
    this.mongoose = this.getMongooseReference();
  }

  _handleExample (payload, ack) {
    console.log(payload);
    ack();
  }

  start () {
    super.start();

    this.publish(QUEUE_NAME, 'Hello World');
}

module.exports = ExampleService;

API

  • addQueues

Events

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.0

9 years ago

0.0.4

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.0

9 years ago