IntermediateInternals
What is the difference between Kafka's Fetch API and consumer.poll()?
Reference answer
The Fetch API is a low-level broker RPC: the consumer sends FetchRequest specifying topic-partitions, starting offsets, min/max bytes, and waits for the response. consumer.poll() is the high-level client abstraction that: manages FetchRequests internally, handles partition assignments, commits offsets (if auto.commit), sends heartbeats via a separate thread, handles rebalances, and returns a ConsumerRecords batch. consumer.poll() is the only supported way to keep the consumer alive (it drives the heartbeat pump). Not calling poll() within max.poll.interval.ms causes the consumer to be kicked from the group.
Expected key concepts: Fetch API, FetchRequest, consumer.poll, partition assignments, heartbeat, rebalance, ConsumerRecords, max.poll.interval.ms, kicked from group