Hi, I have this module
@Module({})
export class AMQPModule {
static registerAsync(options: AMQPModuleAsyncOptions): DynamicModule {
return {
module: AMQPModule,
imports: options.imports,
providers: [{ provide: AMQP_CONNECTION_OPTIONS, useFactory: options.useFactory, inject: options.inject }, AMQPService],
exports: [AMQPService],
};
}
}
and I want AMQPService to first connect with server and then hold this connection but with the code above it doesn't happen even that AMQPService constructor envokes async method with server connection. Is it possible to export AMQPService as prepared value like
exports: [
{
value: async () => {
const service = new AMQPServce();
await service.connect();
return service;
}
}
]
?