1.1.2 • Published 9 months ago

bulltrader-rabbitmq v1.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

RabbitMQ Message Broker

This is a lightweight RabbitMQ library for Node.js that simplifies the process of interacting with RabbitMQ. It provides a simple interface for sending and receiving messages from RabbitMQ exchanges and queues.

Installation

To install the RabbitMQ Light Library, use npm:

npm install rabbitmq-message-broker

Usage

Sending Messages

// Import the RabbitMQ class
const { Rabbitmq, ExchangeDto, RouteDto } = require('rabbitmq-light-library');

// Create a new Rabbitmq instance
const rabbitmq = new Rabbitmq();

// Connect to the RabbitMQ server
await rabbitmq.connect();

// List of existing channels
let channels = await rabbitmq.getChannels();

// Get a specific channel
let channelName = await rabbitmq.getChannel('src', 'dst');

// List of existing Exchanges in the taken channel
let exchanges = await rabbitmq.getExchanges(channelName);

// List of existing Routes in the taken channel
let routes = await rabbitmq.getRoutes(channelName);

// Send a message
await rabbitmq.sendMessage('channelName', 'exchangeName', 'routeName', { your: 'data' });

// Receive a message
await rabbitmq.receiveMessage('channelName', 'routeName', (message) => {
console.log('Received message:', message);
// Add your message handling logic here
});

// Disconnect from the RabbitMQ server
await rabbitmq.disconnect();

Features

  • Easy connection management with the RabbitMQ server
  • Send and receive messages from RabbitMQ exchanges and queues
  • Efficient handling of exchanges and routes
  • Lightweight and easy-to-use interface for RabbitMQ interactions

Contributing

Contributions are welcome! If you have any suggestions, bug fixes, or new features to add, please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

1.1.1

9 months ago

1.1.2

9 months ago

1.1.0

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.12

10 months ago

1.0.7

11 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago