3 Kafka Clients and Message Production

 

This chapter covers

  • Connecting to Kafka
  • Configuring client applications
  • How to send messages using Kafka
  • Typical challenges faced by producer applications.

Here we shift from broker internals to how clients talk to Kafka. We focus on producer basics: configuring clients, connecting, and choosing serializers. Then we see how messages are sent and confirmed, including partitioning, acknowledgments, batching, timeouts, and timestamps. Along the way, we note common pitfalls and how to avoid them. The goal here is to help you send data to Kafka reliably and efficiently, with settings you can justify in production.

3.1 Field notes: Patterns and pitfalls for Kafka clients

The conference room buzzed with anticipation as Max Sellington, Eva Catalyst, and Rob Routine convened to discuss the intricacies of developing client applications for Kafka integration.

Max (leaning forward): Alright team, let's explore the realm of client applications. What are the requirements for our client teams, and how well-versed should they be in Kafka to effectively integrate with it? Additionally, what are the associated costs we need to consider?

Eva (nodding): Max, integrating with Kafka can be quite direct. Frameworks can simplify many of Kafka's complexities, letting teams concentrate on their specific needs. That said, mastering Kafka does demand time and commitment.

3.2 Communicating with Kafka

3.2.1 Configuring clients

3.2.2 Connecting to Kafka

3.2.3 Serializing and deserializing data

3.2.4 Setting quotas

3.2.5 Field notes: Setting up Customer360 project

3.2.6 Architecture Points: Initial Producer Configuration

3.3 Sending a message

3.3.1 Partitioning strategy

3.3.2 Field notes: Partitioning strategy for Customer360

3.3.3 Acknowledgement strategies

3.3.4 Field notes: Acknowledgment strategy for Customer360

3.3.5 Batches and timeouts

3.3.6 Field notes: Configuring producer for Customer360

3.3.7 Common producer issues

3.3.8 Architecture Points: advanced producer configuration

3.4 Online resources

3.5 Summary