0.1.5 • Published 5 years ago

mongo-microservice v0.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
5 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

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.0

8 years ago

0.0.4

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago