mongoose-amqplib-plugin

0.8.0 • Public • Published

mongoose-amqplib-plugin

Publish Mongoose models over AMQP.

Installation

npm install --save mongoose-amqplib-plugin

Usage

var amqpPlugin = require('mongoose-amqplib-plugin');
 
 
// Create an instance of the plugin, and override all of
// the possible options.
Schema1.plugin(amqpPlugin, {
  channel:    amqpChannelInstance,
 
  // For more information about these options, see:
  //   http://www.squaremobius.net/amqp.node/channel_api.html#channel_publish
  exchange:   'the.exchange.name',
  routingKey: 'the.routing.key',
  options:    {persistent: true}
});
 
 
// This time, we'll just use the default values for the
// options.  These are:
//
//  exchange:   'model.events',
//  routingKey: '',
//  options:    undefined
//
Schema2.plugin(amqpPlugin, {
  channel:    amqpChannelInstance
});
 
 
// Of course, maybe you don't like those default options.
// Fine -- just change them.
amqpPlugin.defaultOptions = {
  exchange: "my.better.name",
  options:  {
    persistent: true
  }
};

Package Sidebar

Install

npm i mongoose-amqplib-plugin

Weekly Downloads

1

Version

0.8.0

License

MIT

Last publish

Collaborators

  • briandamaged