wrs

waterline-rabbitmq-simple

RabbitMQ Adapter for Sails and Waterline

Showing:

Popularity

Downloads/wk

1

GitHub Stars

0

Maintenance

Last Commit

6yrs ago

Contributors

3

Package

Dependencies

5

Size (min+gzip)

62.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Waterline RabbitMQ simple Adapter

RabbitMQ Adapter for Sails and Waterline (AMQP 0.9). it is based on sails-rabbitmq I had to modify to fit our needs, there's just a simple PUSH.

Install

$ npm install sails-rabbitmq-simple --save

Configure

1. Setup Connection

// config/connections.js
module.exports.connections = {
  rabbitCluster: {
    adapter: 'sails-rabbitmq-simple',

    /**
     * The url of your rabbitmq installation
     */
    url: 'amqp://localhost:5672',

    /**
     * Define how persistence is managed. 'true' will subscribe to all queues
     * and persist models that are published as messages. 'false' will do
     * nothing. This lets you turn off the persistence worker feature on the
     * Sails.js web server, and enable it in separate worker processes.
     */
    persistence: true
  }
};

2. Setup Models

For Models that you'd like to be able to publish and subscribe to, add the sails-rabbitmq connection to the relevant Models, and define a routingKey.

// api/models/Message
module.exports = {
  connection: [ 'rabbitCluster' ],
  queueName: 'nameOfTheQueue', //if not there will use the collection name
  attributes: {
    title: 'string',
    body: 'string',
    stream: {
      model: 'stream'
    },
    parentMessage: {
      model: 'message'
    }
    // ...
  }
};

```js
{
  title: 'yo dawg',
  body: 'I heard you like messages',
  stream: 'random',
  parentMessage: 1234
}

.create(values, callback)

The .create() method can be called per usual on RabbitMQ-enabled models. Waterline will do a push to the queue with your message.

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100