liveBook · Manning

Fetch request

As explained in Kafka Streams in Action, Second Edition

A fetch request is a Kafka client request that asks a broker to return records from a topic partition starting at a specified offset.

A fetch request is a Kafka client request that asks a broker to return records from a topic partition beginning at a specified offset. The consumer sends the request; the broker queues and processes it, retrieves a batch, and returns that batch in its response. Reading records does not remove them, change retention, or affect other consumers. section 2.3 section 2.10

A typical fetch flow is:

  • The consumer specifies a topic partition and the offset from which it wants to read. section 2.3
  • The broker takes the request from its request queue and fetches a batch of records. section 2.3 section 2.10
  • The broker returns the batch to the consumer, which processes the records. section 2.3

Polling sales records

A Java KafkaConsumer subscribes to topics and repeatedly calls poll. A poll can return records retrieved by a new fetch request or records cached from an earlier call; returned sales records can then be logged or otherwise processed. section 4.3

Figure 2.3 Brokers handling requests from a consumer
figure

Trace the broker-side handling of a consumer fetch request from request arrival through record retrieval and response. section 2.3

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains request inputs, broker queueing, batch retrieval, responses, retention effects, and polling cache behavior without protocol internals.
Examples
Demonstrates broker diagrams and a Java sales consumer that subscribes, polls, and logs transaction values.
What it assumes
Introduces topics, partitions, and offsets as the surrounding concepts needed to understand fetch-request inputs.
What you can do after
Operate a KafkaConsumer that retrieves and processes topic records through subscription and polling.
How it connects
Connects KafkaConsumer, Kafka broker, topics, partitions, offsets, produce requests, and consumer clients.

Also explained in

Compare how 2 books explain fetch request →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.