Kafka Knowledge Base

SkillDocs & knowledge

Kafka knowledge base. Covers Topics/Partitions, Consumer Groups, Producer/Consumer Config, Serialization, Exactly-Once, and Rebalancing. Intended for devlab-middleware-expert to inherit via extends.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Kafka Knowledge Base skill

What this skill tells your AI

The instructions your AI receives, as published by seed-forge/harness-ai-kit in skills/public-kafka-expert-base/SKILL.md and read by ahel’s review.

Foundational guidance for building event streaming applications with Apache Kafka.

Source: Adapted from confluentinc/agent-skills and Apache Kafka best practices.

Topics & Partitions

  • Design topics around domain events (order.created, payment.completed), not database tables.
  • Partition count determines max consumer parallelism — start with 3-6, scale up as needed.
  • Partitions are ordered; messages within a partition have guaranteed order.
  • Use partition keys for related messages that must be ordered (e.g., user_id for user events).

Consumer Groups

  • All consumers in a group share the workload (each partition → one consumer).
  • Multiple groups can independently consume the same topic (fan-out).
  • Consumer offset tracking: committed offsets vs. current position.
  • Use auto.offset.reset=earliest for new groups that need to process all history.

Producer Configuration

SettingDefaultRecommended
acks1all (durability)
retries03+ (transient failures)
linger.ms05-100 (batching)
batch.size16KB32-64KB (throughput)
compression.typenonelz4 or zstd
enable.idempotencetruealways true

Consumer Configuration

SettingDefaultRecommended
auto.offset.resetlatestearliest (first run)
enable.auto.committruefalse (manual commit)
max.poll.records500Tune to processing capacity
session.timeout.ms45s10-30s (failure detection)
heartbeat.interval.ms3ssession.timeout / 3

Serialization

  • Use Avro/Protobuf/JSON Schema with Schema Registry for type safety.
  • Never use Java serialization (not cross-language, not forward-compatible).
  • StringSerializer/StringDeserializer only for simple text messages.

Exactly-Once Semantics

  • Enable enable.idempotence=true on producer (prevents duplicates from retries).
  • Use isolation.level=read_committed on consumer (read only committed transactions).
  • For transactional processing: beginTransaction() → process → commitTransaction().

Rebalancing

  • Triggered when consumers join/leave a group or partitions are reassigned.
  • Use cooperative rebalancing (partition.assignment.strategy=CooperativeStickyAssignor).
  • Handle CommitFailedException during rebalance — retry after rebalance completes.
  • Use ConsumerRebalanceListener for cleanup on partition revocation.

Guardrails

  • Always set acks=all and enable.idempotence=true for producers.
  • Always use manual offset commits (enable.auto.commit=false).
  • Never use Java serialization for Kafka messages.
  • Monitor consumer lag (kafka-consumer-groups --describe).

Signals

GitHub stars
22
Forks
2
Last commit
Aug 2026
Advanced
Catalog kind
skill
Gateway key
public-kafka-expert-base
Source
github.com/seed-forge/harness-ai-kit