@spilne/perfect-kafka-kafkajs
v0.2.0
Published
KafkaJS driver adapter for @spilne/perfect-kafka.
Readme
@spilne/perfect-kafka-kafkajs
KafkaJS driver adapter for @spilne/perfect-kafka.
Install
bun add @spilne/perfect-kafka @spilne/perfect-kafka-kafkajs kafkajsNot yet published to npm — install from the workspace for now.
Quickstart
import { kafkaConfig } from "@spilne/perfect-kafka";
import { createKafkajsClient } from "@spilne/perfect-kafka-kafkajs";
const orders = kafkaConfig<unknown>()
.client(createKafkajsClient(["localhost:9092"]))
.topic("orders")
.group("order-workers")
.build();createKafkajsClient also accepts a KafkaJS-style object with required
brokers plus clientId, SSL, SASL, log level, and other KafkaConfig
options. The adapter supports callback eachMessage and eachBatch modes,
replay/seek, commits, topic administration, and managed partition lifecycle.
createKafkajsTopic(config, topic, partitions?) is the convenience helper for
creating a topic in tests, examples, or application bootstrap code.
