Sample Catalog
A feature-by-feature index of the samples. Browse the source under
sample/ in the
repository.
00-showcase
The full integration baseline. Producer and consumers wired together across feature modules, the full enhancer pipeline, request-scoped DI, parameter decorators, a chained consumer, a transactional producer, and a batch consumer with per-topic concurrency. Never simplified for brevity — richness proves the integration depth.
Related docs: Consumers, Producer, Transactions.
01-producer-basics
The smallest runnable app: KafkaModule.forRoot, the KafkaProducerService, and
a single handler that logs every message it receives.
Related docs: Quick Start, Producer.
02-consumer-enhancers
@KafkaConsumer / @KafkaHandler running through guards, interceptors, pipes, and
filters — a focused walkthrough of the enhancer pipeline on the Kafka transport.
Related docs: Consumers.
03-headers-context-errors
The @KafkaMessage / @KafkaHeaders / @KafkaCtx parameter decorators, error
mapping, and graceful shutdown.
Related docs: Parameter Decorators, Error Mapping, Graceful Shutdown.
04-batch-concurrency
Batch consumption (@KafkaHandler({batch: true}), @KafkaBatch()), per-topic
concurrency (nestjs/nest#12703),
and rebalance-safe offset resolution
(nestjs/nest#12355).
Related docs: Batch & Concurrency.
05-transactions
The transactional producer helper (KafkaProducerService.transactional): atomic
multi-topic writes, abort on throw, and the consume-process-produce sendOffsets
pattern.
Related docs: Transactions.
06-microservice-migration
Porting a @nestjs/microservices Kafka handler to @nest-native/kafka and
testing it with KafkaTestModule and its in-memory broker.
Related docs: Migration Guide, Testing.