refactor(pipeline, repo): rabbitmq
This commit is contained in:
@ -3,22 +3,35 @@ import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { Project } from '../projects/project.entity';
|
||||
import { ReposResolver } from './repos.resolver';
|
||||
import { ReposService } from './repos.service';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { ProjectsModule } from '../projects/projects.module';
|
||||
import { BullModule } from '@nestjs/bull';
|
||||
import { LIST_LOGS_TASK } from './repos.constants';
|
||||
import { ListLogsConsumer } from './list-logs.consumer';
|
||||
import { EXCHANGE_REPO } from './repos.constants';
|
||||
import { RabbitMQModule } from '@golevelup/nestjs-rabbitmq';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([Project]),
|
||||
ConfigModule,
|
||||
ProjectsModule,
|
||||
BullModule.registerQueue({
|
||||
name: LIST_LOGS_TASK,
|
||||
RabbitMQModule.forRootAsync(RabbitMQModule, {
|
||||
imports: [ConfigModule],
|
||||
useFactory: (configService: ConfigService) => ({
|
||||
uri: configService.get<string>('db.rabbitmq.uri'),
|
||||
exchanges: [
|
||||
{
|
||||
name: EXCHANGE_REPO,
|
||||
type: 'topic',
|
||||
options: {
|
||||
durable: true,
|
||||
autoDelete: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
],
|
||||
providers: [ReposResolver, ReposService, ListLogsConsumer],
|
||||
providers: [ReposResolver, ReposService],
|
||||
exports: [ReposService],
|
||||
})
|
||||
export class ReposModule {}
|
||||
|
Reference in New Issue
Block a user