#atom

Subtitle:

Categorized streams of records in Apache Kafka that organize and store events


Core Idea:

Kafka topics are named feeds or categories of events to which data is published by producers and from which data is read by consumers, functioning as logical channels that separate different streams of events.


Key Principles:

  1. Multi-Producer/Multi-Consumer:
    • Topics support multiple producers writing to them and multiple consumers reading from them
  2. Partitioned Storage:
    • Topics are divided into partitions distributed across brokers for parallel processing
  3. Retention Policy:
    • Each topic can have a configurable retention period determining how long events are kept
  4. Append-Only Log:
    • Events are appended to the topic's partitions in an immutable sequence

Why It Matters:


How to Implement:

  1. Topic Creation:
  2. Configure Partitioning:
    • Determine appropriate number of partitions based on throughput needs
  3. Set Retention:
    • Configure time-based or size-based retention policies for the topic

Example:

bin/kafka-topics.sh --create --topic user-signups --partitions 10 --replication-factor 3 --bootstrap-server localhost:9092
bin/kafka-topics.sh --create --topic product-views --partitions 20 --replication-factor 3 --bootstrap-server localhost:9092
bin/kafka-topics.sh --create --topic purchases --partitions 15 --replication-factor 3 --bootstrap-server localhost:9092

Connections:


References:

  1. Primary Source:
    • Apache Kafka documentation on topics
  2. Additional Resources:
    • "Kafka: The Definitive Guide" (Chapter on Topics and Partitions)

Tags:

#kafka #topics #event-organization #messaging #pub-sub


Connections:


Sources: