app = moduleFixture.createNestApplication();
await app.init();
NEST APP IS LIVE NOW, BUT IT IS NOT READY TO OPERATE, SINCE CONNECTION TO RABBIT MAY NOT BE ESTABLISHED YET
Plans:
I would like to prepare separate Connection class and factory, similar as it is done in @nestjs/mognoose package. For now, I am proposing smaller and faster solution.
Before:
The init() method establishing the connection is called inside the constructor in async way. The RMQService may be provided, but not ready to operate.
@mjarmoc added your code to master branch and published in nestjs-rmq@1.7.0 (faster then merging your PR, because of code conflicts). Thanks for contributing!
This PR changes the way RMQ Service is provided.
Problem:
It is very painfull during tests execution:
Plans:
I would like to prepare separate Connection class and factory, similar as it is done in @nestjs/mognoose package. For now, I am proposing smaller and faster solution.
Before:
The init() method establishing the connection is called inside the constructor in async way. The RMQService may be provided, but not ready to operate.
After:
The init method is called sync inside the provider factory. When the connection is sucessfuly established, the provider is resolved.