The Kafka Consumer API
Learn how to receive messages from Kafka using the Consumer API.
Introduction to Kafka consumers
Kafka consumers are responsible for reading data from one or more Kafka topics and processing it in some way. The process of consuming data from Kafka can be broken down into several distinct steps:
Subscribing to topics
Polling for messages
Processing messages
Committing offsets
Subscribing to topics
The first step in consuming data from Kafka is to subscribe to one or more Kafka topics. This is typically done by creating a consumer instance and specifying the names of the topics to subscribe to. The consumer then sends a request to one of the Kafka brokers to join the corresponding consumer group and start receiving messages from the subscribed topics.
Polling for messages
Once the consumer has subscribed to a topic, it begins the process of polling for messages. This involves sending a request to a Kafka broker to fetch a batch of ...