@addapptables/bus
v1.1.3
Published
Bus is a library for nodejs oriented to microservices
Downloads
30
Readme
Bus
Bus is a library for nodejs oriented to microservices
Getting Started
To get started, let's install the package through npm:
npm i @addapptables/bus --S
How to use
- Import the module
import { rabbitmqCreateBus } from '@addapptables/bus';
const bus = rabbitmqCreateBus({ exchange:'nameExchange', host: 'rabbitmqUrlHost'});
// publish
this.bus.publish('action', 'payload', 'context', 'opts');
//subscribe
this.bus.subscribe('action', () =>{
console.log('action called')
}, 'context', 'opts')
//send
this.bus.send('queue', 'pyload', 'opts')
//close
this.bus.close()