Loading page…
Pitch
Description
Comments
The library implements a modular approach, where each module is associated with a single exchange and a bound queue. This makes it an excellent solution for building an API Gateway. The library also includes functionality for working with RPC, middleware, and interceptors, as well as support for all major Topic patterns for handling RabbitMQ requests, along with many other useful features.

Start by installing the @diy0r/nestjs-rabbitmq package:
npm i @diy0r/nestjs-rabbitmq
In your root module, import RmqModule:
import { RmqModule, IRMQExtendedOptions } from '@diy0r/nestjs-rabbitmq';
const extendedOptions: IRMQExtendedOptions = {
typeChannel: TypeChannel.CONFIR_CHANNEL,
globalBroker: {
replyTo: {
queue: '',
options: { exclusive: true },
consumeOptions: { noAck: true },
},
//..
},
//...
};
@Module({
imports: [
RmqModule.forRoot({
connectOptions: {
username: 'username',
password: 'password',
hostname: 'localhost',
port: 5672,
vhost: '/',
protocol: 'amqp',
},
extendedOptions, //optional
}),
],
providers: [SomeService],
})
export class AppModule {}
@Module({
imports: [
RmqModule.forRootAsync({
useFactory: async (...providers: any[]) => ({
connectOptions: {
username: 'username',
password: 'password',
hostname: 'localhost',
port: 5672,
vhost: '/',
protocol: 'amqp',
},
extendedOptions, //optional
}),
inject: [],
imports: [],
}),
],
providers: [SomeService],
})
export class AppModule {}
No comments yet.
Sign in to be the first to comment.