nestjs-kafkajs-module
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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

/nestjs-kafkajs-module/

    Package Sidebar

    Install

    npm i nestjs-kafkajs-module

    Weekly Downloads

    2

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    8.56 kB

    Total Files

    12

    Last publish

    Collaborators

    • jalorenz