liveBook · Manning

Kafka client library

As explained in Kafka for Architects

A Kafka client library is a software library that provides APIs and client-side behavior for producing and consuming Kafka records.

A customer-profile service may publish changes to Kafka while another service reads profile, billing, and interaction events to assemble a fuller view. A Kafka client library supplies the application-side behavior for that exchange: producers send records, and consumers retrieve and process them. The application still owns its business logic. section 3.1

A producer client does more than transmit each record immediately. It encodes messages as bytes, selects partitions, assembles batches, sends them to brokers, and can wait for acknowledgments or retry after errors. These behaviors affect throughput and delivery, so client configuration is an architectural decision rather than incidental plumbing. section 3.1.1 section 3.1.2

The integration choice determines how much control the application team takes on:

  • A low-level client exposes finer control over message conversion, dead-letter routing, consumer concurrency, and offset handling. section 3.1
  • Spring-Kafka and Micronaut-Kafka streamline development but can obscure underlying client behavior. section 3.1
  • A REST proxy offers an HTTP integration path; native libraries provide fuller feature access and avoid HTTP overhead. section 4.0

Keep client code straightforward and tune behavior through name-value parameters. A typical service combines application code, a Kafka client library, serialization libraries, other dependencies, and external configuration. Separate configuration allows environments to use different settings without changing application code. Consumer instances can also form a group to divide work across partitions; one instance can handle all partitions when parallel processing is unnecessary. section 3.1.2 section 2.2.2

Figure 3.1 Simplified workflow of message transmission by a producer, including serialization, partition selection, batch assembly, and data transmission to the server, with an optional confirmation step
A screen shot of a computer screen

Description automatically generated

Follow the producer path from serialization and partition selection through batching and transmission to optional broker confirmation. section 3.1.1

Clients use Kafka’s binary protocol over TCP/IP. Libraries exist in multiple languages and follow the same broad architecture and configuration model. When a client connects, protocol-version negotiation selects a mutually supported API version automatically, allowing compatible clients and brokers to be upgraded independently. section 3.1.1

How Kafka for Architects covers it

How deep it goes
Explains producer transmission, configuration, and protocol negotiation architecturally, without a low-level implementation walkthrough.
Examples
Uses customer-profile services that publish changes and combine profile, billing, and interaction events.
What you can do after
Operate/configure it through external parameters and choose between low-level clients, frameworks, and a REST proxy.
How it connects
Links client libraries to producer batching, partition selection, consumer groups, serialization, offset handling, and Kafka frameworks.

Also explained in

Compare how 2 books explain Kafka client library →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka for Architects. The section links point to the parts of the book it draws on.