qb-nats

0.0.1 • Public • Published

qb-nats

A pub/sub nats dialect for qb

Note: I suggest running the gnatsd server which is written in Go. I like Go better than ruby (also its probably faster).

Usage

npm install qb-nats --save
qb.speaks(require('qb-nats'), { nats: natsOptions })
  .start()
 
  // Access a channel using nats and qb's `contact` polymethod
  .contact('nats://new-users-channel')
    // Listen for messages on this channel
    .subscribe(function onNewUser(msg) {})
    // Or you can directly invoke a service queue
    .subscribe('service-to-execute-with-message');
 
// Or you can create an alias
qb.contacts('nats://some-channel', 'some-channel')
  .contact('some-channel')
  // And lastly, you can publish on channels
  .publish({a: 'message', to: 'be', deliv:'ered'});

Options:

See the node nats client for documentation on the nats options.

License

MIT in LICENSE file

Readme

Keywords

none

Package Sidebar

Install

npm i qb-nats

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • yanatan16