From the course: Apache Kafka Essential Training: Getting Started (2021)

Topics

- [Narrator] Topics in Kafka hold and manage messages. Let's explore more on topics in this video. A topic in Kafka is an entity that holds messages. It's similar to a file that contains papers. When messages represent the papers, it's similar to a database table that contains records, where messages represent the records. Topics can be considered as a queue, for similar messages. A topic itself does not pose any limitation, on what the content of its message should be. So technically, a topic can contain all kinds of messages with different formats, but in practice, they're used to hold similar messages. What does similar mean in this case? Usually, the content of the messages are similar and have the same set of producers and consumers. Examples of topics include; sales transactions, audit logs, video files, etcetera. Kafka support multiple topics, per Kafka instance. So topics can be created based on specific use cases. And multiple application domains can create topics, in the same Kafka instance. Each topic support multiple producers to publish data to the topic concurrently. Similarly, multiple consumers can consume data from this topic. Each topic has multiple partitions that physically split data across multiple files. Here is an example of how topics exist in Kafka. In this case, we have one Kafka instance with two topics, orders and logs. The orders topic has three partitions, P1, P2 and P3. There are eight messages in the topic named M1 to M8. The messages are distributed across three partitions. Each message, will only be stored in one partition. Similarly, the logs topic has two partitions and six messages. We will discuss partitions in detail, later in the course. In the next video, let's discuss Kafka brokers.

Contents