hi!
i have a basic nestjs setup with a service which should start consuming some rabbitmq queues. i've been using the constructor to call this initial function for years in nestjs but for some reason this constructor (and onmoduleinit) arent called before a request is made to the controller using the service
@Module({
imports: [
AuthModule,
UsersModule,
SpotifyElasticModule,
StreamsModule,
ChartsModule,
BackblazeModule,
ArtistsModule,
AlbumsModule,
RabbitModule,
RedisModule,
NotificationsModule,
],
controllers: [
SwipefyMeController,
SwipefyUsersController,
SwipefyTracksController,
SwipefyArtistsController,
SwipefyAlbumsController,
SwipefyChartsController,
],
providers: [SwipefyService],
exports: [SwipefyService],
})
export class SwipefyModule {}
@Injectable()
export class SwipefyService implements OnModuleInit {
private readonly logger = new Logger('Swipefy');
private previewUrlChannel;
constructor(
private readonly prisma: PrismaService,
private readonly redis: RedisService,
private readonly elastic: ElasticService,
private readonly rabbit: RabbitService,
private readonly backblaze: BackblazeService,
private readonly auth: AuthService,
private readonly spotifyElasticService: SpotifyElasticService,
private readonly users: UsersService,
private readonly streams: StreamsService,
private readonly charts: ChartsService,
private readonly artists: ArtistsService,
private readonly albums: AlbumsService,
) {
console.log('test'):
}
async onModuleInit() {
console.log('test2'):
}
is there anything I can try to make sure they're being run? thanks 🙂
^sjoerd