chapter two

2 First steps with Kafka

 

This chapter covers

  • Introduction to our use case, which will be consistently referenced throughout the book
  • Creating a topic with kafka-topics.sh
  • Producing messages with kafka-console-producer.sh
  • Consuming messages with kafka-console-consumer.sh

In this chapter, we'll delve into the realm of Apache Kafka, gaining our initial insights into its functionality. Our journey begins with the creation of a primary topic, followed by the production of messages directed to this topic. Ultimately, we'll complete the loop by consuming these messages once more, providing a comprehensive exploration of Apache Kafka's fundamental operations.We assume that Kafka is already installed. We have described the exact installation instructions to create a Kafka cluster with 3 brokers in the appendix.

2.1 Introduction to our use case

Throughout this book, we will use a consistent use case to illustrate how Apache Kafka can be effectively utilized in real-world scenarios. Our chosen use case revolves around an e-commerce platform, as shown in Figure 2.1, which serves as a practical example to demonstrate Kafka's capabilities.

Figure 2.1 The high-level IT architecture for our online shopping platform.

2.2 Producing messages

2.3 Consuming messages

2.4 Consuming and producing messages in parallel

2.5 Graphical User Interfaces for Kafka

2.6 Summary