nestjs-kafkajs-module
v0.0.2
Published
## Roadmap
Downloads
5
Readme
nestjs-kafkajs-module
Nest.js module for injecting Kafka.js producer and consumer in Nest.js application.
Installation
npm install nestjs-kafkajs-module
Usage
import { KafkajsModule } from "nestjs-kafkajs-module";
import { KafkaConfig } from "kafkajs";
const config: KafkaConfig = {
clientId: "example",
brokers: ["localhost:9092"],
};
@Module({
imports: [
KafkajsModule.register(config, "exampleConsumerGroup"),
],
})
export class AppModule {}
import { Injectable } from "@nestjs/common";
import { InjectConsumer, InjectProducer } from "nestjs-kafkajs-module";
import { Consumer, Producer } from "kafkajs";
@Injectable()
class ExampleService {
constructor(
@InjectConsumer() private readonly consumer: Consumer,
@InjectProducer() private readonly producer: Producer,
) {}
}
Roadmap
- [x] Expose module to be able to inject Kafka.js producer and consumer in Nest.js application
- [x] Add CI
- [x] Publish to npm
- [ ] Add semantic versioning
- [ ] Build decorator for consumers