Help us improve
Share bugs, ideas, or general feedback.
From golang-boost
Guides writing/reviewing Go event-driven services consuming Kafka via xgodev/boost bootstrap adapter. Covers consumer-group wiring, offset commits, and a ctx-loss workaround for graceful shutdown.
npx claudepluginhub xgodev/boost --plugin golang-boostHow this skill is triggered — by the user, by Claude, or both
Slash command
/golang-boost:boost-bootstrap-adapter-kafkaThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
**REQUIRED BACKGROUND:**
Constructs raw Kafka producers and consumers using the Confluent client via github.com/xgodev/boost/factory/contrib/confluentinc/confluent-kafka-go/v2. Covers NewProducer/NewConsumer and canonical examples.
Produces and consumes Kafka messages using KafkaJS with partitioning, consumer groups, offset management, and transactions for event streaming, sourcing, and CDC pipelines.
Guides Kafka topic design (partitions, replication), KafkaJS idempotent producers/consumers, consumer lag monitoring, exactly-once semantics, schema registry, compacted topics, and DLQ patterns. Use for reliable streaming implementations.
Share bugs, ideas, or general feedback.
REQUIRED BACKGROUND:
boost-bootstrap-function — handler typing rule.boost-bootstrap-middleware — recovery/logger/publisher chain.boost-extra-middleware — NewAnyErrorWrapper for the workaround.boost-bootstrap-adapter-pubsub — same shape, full workaround pattern documented there.import (
akafka "github.com/xgodev/boost/bootstrap/function/adapter/contrib/confluentinc/confluent-kafka-go/v2"
"github.com/xgodev/boost/bootstrap/function"
)
fn, _ := function.New[*cloudevents.Event](rec, lmi, pmi)
fn.Run(ctx, handle, akafka.New[*cloudevents.Event](consumer))
Topics, consumer group, broker list, and offset reset behavior are configured via boost.bootstrap.function.adapter.kafka.* (override via BOOST_BOOTSTRAP_FUNCTION_ADAPTER_KAFKA_*).
bootstrap/function/adapter/contrib/confluentinc/confluent-kafka-go/v2/helper.go:41 hard-codes:
err := subscriber.Subscribe(context.Background())
SIGTERM does not gracefully drain in-flight messages. Apply the same workaround pattern documented in boost-bootstrap-adapter-pubsub: bypass fn.Run, build the chain via extra/middleware.NewAnyErrorWrapper, drive akafka.NewSubscriber with a signal-aware ctx, and add the // TODO(boost-upstream): annotation naming the offending file.
Kafka delivers each message to exactly one member of a consumer group. The boost adapter respects the group config — set boost.bootstrap.function.adapter.kafka.groupID so multiple replicas of your service share the partition load.
Offsets commit on successful handler return (post-publisher middleware). A handler error propagates as a nack — the message replays per Kafka's redelivery semantics. Wrap errors via bootsterrors.Wrap (see boost-model-errors) so the deadletter middleware can route by type.
| Red flag | Fix |
|---|---|
kafka.Consumer.Poll(...) / ReadMessage(...) loops directly | Use akafka.NewSubscriber(...).Subscribe(ctx) or function.New + fn.Run |
Bypass of fn.Run without // TODO(boost-upstream): naming helper.go:41 | Add the comment, OR accept ungraceful shutdown |
Reading KAFKA_BROKERS / KAFKA_GROUP_ID via os.Getenv | Use BOOST_BOOTSTRAP_FUNCTION_ADAPTER_KAFKA_* overrides |
| Manual offset commit inside the handler | Let the publisher middleware drive commit on success (default) |