From golang-boost
Guides writing or reviewing Go event-driven services that consume Kafka via the boost bootstrap adapter. Covers consumer-group wiring, offset commit semantics, and the ctx-loss workaround for graceful shutdown.
How 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:**
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) |
npx claudepluginhub xgodev/boost --plugin golang-boostConstructs raw Kafka producers and consumers using the boost factory layer for Confluent Kafka Go client, with canonical examples and configuration via BOOST_FACTORY_KAFKA_*.
Produces and consumes Kafka messages with partitioning, consumer groups, offset management, and transactional support using KafkaJS.
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.