What is a Kafka topic?

A Kafka topic is a named, append-only log where producers write records and from which consumers read, acting as the core unit of data organization in Kafka.

Key Points

Example

An e-commerce system might have an "orders" topic where the checkout service produces new order events and the shipping, billing, and analytics services each consume from it independently, at their own pace.

// Spring Boot creates the topic at startup if it doesn't exist
@Configuration
public class TopicConfig {

    @Bean
    public NewTopic ordersTopic() {
        return TopicBuilder.name("orders")
                .partitions(6)
                .replicas(3)
                .config("retention.ms", "604800000")   // keep events for 7 days
                .build();
    }
}

// Producer side (checkout service)
kafkaTemplate.send("orders", order.getId(), orderJson);

// Consumer side (shipping service)
@KafkaListener(topics = "orders", groupId = "shipping-service")
public void ship(String orderJson) { /* ... */ }

Interview Tip

A concise interview answer is

A Kafka topic is a named log that producers append records to and consumers read from, split into partitions so the data can be distributed across brokers and read in parallel while still preserving order within each partition.

Last updated: 11 November 2026

Previous question: What components make up the Kafka architecture?

Next question: How do you create a topic in Kafka?

More Kafka (Optional) interview questions

All Kafka (Optional) questions