@deadstone/nestjs-rabbitmq
v1.0.0
Published
A package for RabbitMQ integration
Downloads
95
Readme
@deadstone/rabbitmq
A Nest.js module for RabbitMQ integration.
Installation
Usage
Importing Module
Injecting RabbitService
API Reference
RabbitmqModule.forRoot(options: RabbitModuleOptions): DynamicModule
Creates a dynamic module for synchronously configuring the RabbitMQ connection options.
options
(RabbitModuleOptions): RabbitMQ connection options.
RabbitmqModule.forRootAsync(options: RabbitModuleAsyncOptions): DynamicModule
Creates a dynamic module for asynchronously configuring the RabbitMQ connection options.
options
(RabbitModuleAsyncOptions): Asynchronous RabbitMQ connection options.
RabbitmqService
The RabbitMQ service provides methods for interacting with RabbitMQ.
Methods
connect(): Promise<void>
: Establishes a connection to RabbitMQ.disconnect(): Promise<void>
: Closes the connection to RabbitMQ.assertQueue(name: string, options: QueueOptions): Promise<string>
: Asserts a queue in RabbitMQ.sendToQueue(queue: string, data: Record<string, any>, options: MessageOptions): void
: Sends a message to the specified queue.subscribeToQueue(queue: string, callback: QueueCallback, options: QueueOptions = {}): Promise<string>
: Subscribes to a queue in RabbitMQ.
Contributing
Contributions welcome! See Contributing.
Notes
This project is not endorsed by or affiliated with RabbitMQ.
Author
Ruslan Pakhlivanov, github.
License
Licensed under the MIT licensed.