fix(reward): register EventConsumerController to enable Kafka consumption
EventConsumerController was not registered in KafkaModule, causing
@MessagePattern('planting.order.paid') to never be subscribed.
This resulted in reward-service having empty memberAssignment.
Also added forwardRef to resolve circular dependency between
ApplicationModule and InfrastructureModule.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4972e56ad2
commit
9e6fc04344
|
|
@ -1,4 +1,4 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { Module, forwardRef } from '@nestjs/common';
|
||||
import { ScheduleModule } from '@nestjs/schedule';
|
||||
import { RewardApplicationService } from './services/reward-application.service';
|
||||
import { RewardExpirationScheduler } from './schedulers/reward-expiration.scheduler';
|
||||
|
|
@ -9,7 +9,7 @@ import { InfrastructureModule } from '../infrastructure/infrastructure.module';
|
|||
imports: [
|
||||
ScheduleModule.forRoot(),
|
||||
DomainModule,
|
||||
InfrastructureModule,
|
||||
forwardRef(() => InfrastructureModule),
|
||||
],
|
||||
providers: [
|
||||
RewardApplicationService,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { Module, forwardRef } from '@nestjs/common';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { ClientsModule, Transport } from '@nestjs/microservices';
|
||||
import { EventPublisherService } from './event-publisher.service';
|
||||
import { EventConsumerController } from './event-consumer.controller';
|
||||
import { EventAckPublisher } from './event-ack.publisher';
|
||||
import { ApplicationModule } from '../../application/application.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
forwardRef(() => ApplicationModule),
|
||||
ClientsModule.registerAsync([
|
||||
{
|
||||
name: 'KAFKA_SERVICE',
|
||||
|
|
@ -25,7 +29,8 @@ import { EventPublisherService } from './event-publisher.service';
|
|||
},
|
||||
]),
|
||||
],
|
||||
providers: [EventPublisherService],
|
||||
exports: [EventPublisherService, ClientsModule],
|
||||
controllers: [EventConsumerController],
|
||||
providers: [EventPublisherService, EventAckPublisher],
|
||||
exports: [EventPublisherService, EventAckPublisher, ClientsModule],
|
||||
})
|
||||
export class KafkaModule {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue