---
title: "Kafka consumer poll loop: subscribe, poll, fetch"
description: "A single consumer subscribes to a topic and polls in a loop. Each poll fetches the next committed Kafka records and advances its position until it is caught up."
url: https://monedula.dev/kafka-simulator/scenarios/subscribe-poll-fetch-loop/
---

# Kafka consumer poll loop: subscribe, poll, fetch

Scenario 02.1.1 · Subscribe, poll, fetch loop. Consumer groups · Intermediate · about 2 min · Apache Kafka 4.3.

A consumer subscribes and polls in a loop; each poll fetches new committed records and advances its position.

Run it: https://monedula.dev/kafka-simulator/playground/?scenario=02.1.1

## What you start with

A Kafka consumer is not pushed a stream - it drives a poll loop. Here a single consumer subscribes to a topic and repeatedly polls; each poll fetches the next batch of committed records from the broker and advances the consumer's in-memory position.

## Step by step

1. **Consumer subscribed · position 0** (t+0.000s): The consumer c1 has subscribed to 'orders' and is polling in a loop. The log is empty and its position is 0. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=02.1.1&t=0)
2. **First poll fetches O1 · position 1** (t+0.900s): O1 was produced and committed; the next poll fetched it and advanced the consumer's position to 1. This poll → fetch → advance step is the consumer's fetch loop. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=02.1.1&t=1)
3. **Keeping up with the stream** (t+1.700s): As more records commit, each poll fetches them and advances the position. The consumer reads only committed records (offsets below the high watermark). [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=02.1.1&t=2)
4. **Caught up · position 3** (t+2.400s): All three records have been fetched (position 3). With nothing new to read, further polls return empty until the producer writes again. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=02.1.1&t=3)

## The takeaway

Consumption is pull-based and stateful: the position moves forward one fetched batch at a time, and a consumer only ever sees records up to the partition's high-watermark.

## Further reading

- [Apache Kafka documentation](https://kafka.apache.org/43/design/design/#the-consumer)
