@togethercrew.dev/tc-messagebroker
v0.0.50
Published
a service that include common things that need in every microservies
Downloads
392
Readme
tc-messageBroker
RabbitMQ library written in TypeScript. Responsible for brokering messages between different services.
Install
npm i @togethercrew.dev/tc-messagebroker
Initial RabbitMQ
in root directory
import RabbitMQ from '@togethercrew.dev/tc-messagebroker';
RabbitMQ.connect("connectionURL", "queueName").then(() => {
console.log("RabbitMQ was connected!")
})
Push to the specific queue and event
import RabbitMQ from '@togethercrew.dev/tc-messagebroker';
RabbitMQ.publish("queueName", "eventName", { key: "value" })
Subscribe on specific event
import RabbitMQ from '@togethercrew.dev/tc-messagebroker';
RabbitMQ.onEvent("eventName", (msg) => {})
Ensure that the
onEvent
function is called when the application is launched