-
The easy-message-broker library is an HTTP messaging solution designed to simplify and expedite the message exchange process, offering a straightforward and user-friendly approach for users. With the aim of making messaging integration an accessible and efficient task, the easy-message-broker library employs the AMQP (Advanced Message Queuing Protocol) protocol to provide a robust and reliable infrastructure.
-
Access the library in NPM: Easy-Message-Broker.
- Install the lib:
npm install easy-message-broker
import { MessageBroker } from 'easy-message-broker';
const queue = new MessageBroker();
async function examplePublishMessage() {
const queue = new MessageBroker();
await queue.connect('localhost');
await queue.createQueue('testeQueue')
await queue.createExchange('testExchange');
await queue.bindQueueToExchange('testeQueue', 'testExchange');
await queue.publishMessage('testExchange', '', 'textMessage')
}
async function exampleConsumeQueue() {
const queue = new MessageBroker();
await queue.connect('localhost');
await queue.consumeQueue('testeQueue')
}