Skip to content
This repository has been archived by the owner on Mar 17, 2019. It is now read-only.

Latest commit

 

History

History
66 lines (47 loc) · 1.64 KB

README.md

File metadata and controls

66 lines (47 loc) · 1.64 KB

seneca-nats-transport

NPM Build Status Coverage

Seneca NATS transport.

Seneca is a microservices framework and NATS is an open-source, high-performance, lightweight cloud messaging system. This library provides a publish-subscribe message distribution model.

Installation

npm install seneca-nats-transport

Usage

gnatsd server should be running.

// server.js

require('seneca')()
  .use('nats-transport')
  .add({role: 'foo', cmd: 'bar'}, function(msg, done) { return done(null, msg); })
  .listen({type:'nats'});
// client.js

require('seneca')()
  .use('nats-transport')
  .client({type:'nats'})
  .act({role: 'foo', cmd: 'bar', arg1: 1, arg2: 2}, console.log);
// nats.js

require('nats').connect().subscribe('*', function(msg) {
  console.log(msg);
});
gnatsd
node nats.js
node server.js
node client.js

License

Licensed under The MIT License (MIT)
For the full copyright and license information, please view the LICENSE.txt file.