@opra/nestjs-kafka
v1.28.5
Published
Opra NestJS Kafka Module
Readme
@opra/nestjs-kafka
NestJS Kafka module for the OPRA framework
🌐 Documentation · 🚀 Getting Started · 📦 Packages · 💬 Issues
NestJS Kafka module for the OPRA framework. Wire up Kafka consumers in your NestJS application using OPRA's decorator-driven operation model.
Features
OpraKafkaModule— Dynamically configurable NestJS module (forRoot/forRootAsync)- Full NestJS dependency injection and provider support
- Interceptor middleware pipeline
- Shares the same operation model as your HTTP and WebSocket services
Installation
npm install @opra/nestjs-kafkaUsage
import { Module } from '@nestjs/common';
import { OpraKafkaModule } from '@opra/nestjs-kafka';
@Module({
imports: [
OpraKafkaModule.forRoot({
name: 'MyKafkaAPI',
client: {
clientId: 'my-service',
bootstrapBrokers: ['localhost:9092'],
},
consumers: {
'my-group': { sessionTimeout: 30000 },
},
controllers: [OrdersController],
providers: [OrdersService],
}),
],
})
export class AppModule {}Async configuration
OpraKafkaModule.forRootAsync({
useFactory: (config: ConfigService) => ({
client: { bootstrapBrokers: [config.get('KAFKA_BROKER')] },
controllers: [OrdersController],
}),
inject: [ConfigService],
})Node Compatibility
- node >= 20.x
License
Available under MIT license.
