Home / Apache Kafka / Lesson 1
Why Kafka
Fundamentals. A free Apache Kafka lesson in simple English (4:30 minutes).
Open in the academy (practice, progress and notes)
Chapters
- 0:00 What you will learn
- 0:20 About the exam
- 0:43 The problem Kafka solves
- 1:06 How Kafka helps
- 1:32 What is an event?
- 1:59 Producer, topic and consumer
- 2:34 Three things Kafka can do
- 3:08 Practice question 1
- 3:37 Practice question 2
- 4:09 Summary
Lesson text
0:00 What you will learn
Welcome to lesson one of our Apache Kafka course. We start from zero, and we use simple English. Today you will learn what problem Kafka solves, what an event is, and what producers, topics and consumers do. This is an independent course. It is not made or approved by Confluent, or the Apache Software Foundation.
0:20 About the exam
Our target is the Confluent Certified Developer exam for Apache Kafka. Its short name is CCDAK. You have ninety minutes. You take it online, with a supervisor, and without notes. The certificate is valid for two years. The exam can change, so check the official Confluent page and the free exam guide before you book.
0:43 The problem Kafka solves
Imagine an online shop. When a customer places an order, the order system must tell payments, stock, and email. If the order system calls each one and waits, a slow email system can slow down the order. And when we add a new system, such as fraud checks, the order system must change again. The systems depend too much on each other.
1:06 How Kafka helps
Now let's put Kafka in the middle. The order system sends one message to Kafka: an order was placed. Payments, stock and email each read that message from Kafka, at their own speed. The order system does not wait for them. If email stops for an hour, it can catch up later, as long as Kafka still has the messages. New systems can also read the same orders.
1:32 What is an event?
In Kafka, we call that message an event, or a record. An event says that something happened. For example, Asha ordered a phone. An event can have a key, a value, and a timestamp. Here, the key is the order number, the value is the order details, and the timestamp is the time. It can also have headers, which hold extra information. You will use keys a lot in later lessons.
1:59 Producer, topic and consumer
Now, three important words. A producer is an application that writes events to Kafka. Here, the order system is the producer. A topic is a named place where events are stored. Ours is called orders. Think of it like a notebook: new events are added at the end. Later, you will see that a topic has parts called partitions. A consumer is an application that reads events from Kafka. Payments, stock and email are consumers. Here is something many beginners miss. Reading an event does not delete it. Kafka keeps events based on the topic's settings, so other applications can read them too.
2:34 Three things Kafka can do
Kafka brings three abilities together. First, applications can write and read streams of events. A stream is a continuous flow of events. Second, Kafka can store events safely, for as long as you need. Third, applications can process events when they arrive, or later. For example, they can count orders every minute. But Kafka is not the right choice for every project. For a small app, where one system just needs a quick answer from another, a simple API call may be easier.
3:08 Practice question 1
Question one. A temperature sensor application writes a new reading to Kafka every minute. What is this application? A, a consumer. B, a topic. C, a producer. Or D, a timestamp.
The answer is C, a producer. It writes events to Kafka.
3:37 Practice question 2
Question two. The stock application reads an order event. What happens to that event in the topic? A, it is deleted right away. B, it stays, based on the topic's settings. C, it moves to the stock application. Or D, it becomes a key.
The answer is B. Reading does not delete the event, so other applications can read it too.
4:09 Summary
Let's review. Kafka lets systems share events, without calling each other directly. Producers write events, topics store them, and consumers read them. And remember, reading an event does not delete it. In the next lesson, we will open a topic, and learn about partitions and offsets. Thank you for learning with us.
Practice questions
A temperature sensor application writes a new reading to Kafka every minute. What is it?
Answer: A producer. A producer writes events to Kafka.
The stock application reads an order event. What happens to that event in the topic?
Answer: It stays, based on the topic's settings. Reading does not delete an event. The topic's settings control how long Kafka keeps it.