@addapptables/bus

Bus is a library for nodejs oriented to microservices

Usage no npm install needed!

<script type="module">
  import addapptablesBus from 'https://cdn.skypack.dev/@addapptables/bus';
</script>

README

Bus

Bus is a library for nodejs oriented to microservices

Example code

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()