https://github.com/jalorenz/nestjs-kafkajs-module
Importable module for Nest.js to use in Kafka.js in your application
https://github.com/jalorenz/nestjs-kafkajs-module
event kafka kafkajs module nestjs typescript
Last synced: 6 months ago
JSON representation
Importable module for Nest.js to use in Kafka.js in your application
- Host: GitHub
- URL: https://github.com/jalorenz/nestjs-kafkajs-module
- Owner: jalorenz
- License: mit
- Created: 2024-02-05T14:12:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-05T17:25:03.000Z (over 1 year ago)
- Last Synced: 2025-04-21T19:53:31.958Z (6 months ago)
- Topics: event, kafka, kafkajs, module, nestjs, typescript
- Language: TypeScript
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nestjs-kafkajs-module
Nest.js module for injecting Kafka.js producer and consumer in Nest.js application.
## Installation
```bash
npm install nestjs-kafkajs-module
```## Usage
```typescript
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 {}
``````typescript
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