Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RabbitMQModule - forRoot and forRootAsync methods not running #97

Closed
O1lpunch3r opened this issue Jan 20, 2020 · 1 comment
Closed

RabbitMQModule - forRoot and forRootAsync methods not running #97

O1lpunch3r opened this issue Jan 20, 2020 · 1 comment

Comments

@O1lpunch3r
Copy link

I have the latest version of these fantastic RabbitMQ-Module. But i can not use the forRoot method like documented in the README. The function parameters look unnormal, why are there two parameters? What is the moduleCtor?

(method) IConfigurableDynamicRootModule<RabbitMQModule, RabbitMQConfig>.forRoot(moduleCtor: Type<RabbitMQModule>, moduleConfig: RabbitMQConfig): DynamicModule Expected 2 arguments, but got 1.

My example implementation like in README:

@Module({ imports: [ RabbitMQModule.forRoot({ exchanges: [ { name: 'exchange1', type: 'topic' } ], uri: 'amqp://rabbitmq:rabbitmq@localhost:5672', connectionInitOptions: { wait: false } }) ], providers: [EventService] }) export class EventModule { }

@WonderPanda
Copy link
Collaborator

Hey @O1lpunch3r it's my fault for not having updated the docs for this. moduleCtor is just the constructor function for the RabbitMQModule. You can see how to use it here:

RabbitMQModule.forRoot(RabbitMQModule, {

This is because the RabbitMQModule is built using @golevelup/nestjs-modules which eliminates almost all of the boilerplate for creating Dynamic Modules with the tradeoff that you need to pass in the Constructor Function yourself when using forRoot / forRootAsync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants