Skip to main content

@nest-native/kafka

Decorator-first NestJS Kafka transport on Confluent’s officially supported client, with the full Nest enhancer pipeline intact

Nest

Decorator-First Transport

Mark a class with @KafkaConsumer and its methods with @KafkaHandler. The @MessagePattern / @EventPattern ergonomics carry over from @nestjs/microservices.

Pipe

Full Enhancer Pipeline

@UseGuards, @UseInterceptors, @UsePipes, and @UseFilters work on handler methods exactly as they do on an HTTP controller, including request-scoped providers.

Conf

Confluent, Not kafkajs

Built on Confluent’s officially supported @confluentinc/kafka-javascript client, the replacement the community asked for in nestjs/nest#13223.

Fix

Correctness Gaps Closed

Per-topic concurrency (#12703), rebalance-safe batch offsets (#12355), and exception mapping instead of swallowing (#9679) each have a regression test.

Zero

Zero Runtime Dependencies

The published package keeps dependencies empty. Nest, the Confluent client, and validators stay peers under the host application’s control.

Test

Test Without A Broker

KafkaTestModule runs the whole transport — producer, consumers, batches, transactions, shutdown — against an in-memory broker. No librdkafka, no KAFKA_BROKERS.