chapter four

4 Producers: sourcing data

 

This chapter covers:

  • Exploring the producer write path and how it works
  • Creating custom producer serializers and partitioners
  • Examining various configuration options that we can apply to solve a company’s requirements

In the previous chapter, we started to look at some of the requirements that an organization might have regarding their data. Some of the design decisions that we made have practical impacts on how we will need to send data into Kafka. Let’s enter the world of an event-streaming platform through the portal gate of Kafka Producer.

After reading this chapter, you will be on your way to solving fundamental requirements by producing data in a couple of different ways. The producer, despite its importance, is only one part of this system. In fact, some producer configuration options can be changed or set at the broker or topic level. We will discover those options as we get further along. However, getting data into Kafka is our first concern in this chapter.

4.1 Introducing the Producer

The producer will be the way we push data into the Kafka system.

Figure 4.1. Kafka Producers
Producers in Context

4.1.1 Key Producer Write Path

4.2 Important Options

4.2.1 Producer Options

4.2.2 Configuring the Broker list

4.2.3 How to go Fast (or Safer)

4.2.4 Timestamps

4.2.5 Adding compression to our messages

4.2.6 Custom Serializer

4.2.7 Producer Interceptor

4.2.8 Our own partition code

4.3 Generating data for our requirements

4.3.1 Client and Broker Versions

4.4 Summary