1.3.1 • Published 7 years ago

nats-method v1.3.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Nats Method

Help define methods for nats.

Installation

npm install --save nats-method

Usage

const connectNats = require('nats-method')

const natsMethod = connectNats('nats://localhost:4222')
  .setDefaultTimeout(60 * 1000) // optional
  .setMethodPrefix('test') // optional
  .setQueueGroup('test') // optional, but you should provide it if you want to launch multiple instances.
    
natsMethod.define('hello', async (msg) => 'hi ' + msg)

natsMethod.call('test.hello').then(msg => console.log(msg))

natsMethod.callAndForget('test.hello')

// if you don't use this connection anymore, you can close it.
natsMethod.close()

License

MIT

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago