...

/

The Kafka Consumer API

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:

  1. Subscribing to topics

  2. Polling for messages

  3. Processing messages

  4. Committing offsets

Press + to interact
Kafka Consumer high-level workflow
Kafka Consumer high-level workflow

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 ...

Access this course and 1400+ top-rated courses and projects.