Which statement about the Consumer assign() method is correct?

Study for the CCDAK Apache Kafka Test. Use flashcards and multiple choice questions with hints and explanations for each question. Prepare thoroughly for your exam!

Multiple Choice

Which statement about the Consumer assign() method is correct?

Explanation:
Assign() is about fixing which partitions a consumer will read from. In Kafka, there are two ways to tell a consumer what data to process: subscribing to topics, which uses the consumer group protocol to automatically assign partitions, and manually assigning partitions with assign(). When you call assign() and pass a set of TopicPartition objects, you bind this consumer to those specific partitions and it will only consume from them. This bypasses the dynamic partition rebalancing that happens with subscribe(). It’s not about committing offsets automatically, closing the consumer, or creating a new consumer group—the latter two are done by other methods/properties. Therefore, the statement that best describes assign() is that it assigns partitions for the consumer to read from.

Assign() is about fixing which partitions a consumer will read from. In Kafka, there are two ways to tell a consumer what data to process: subscribing to topics, which uses the consumer group protocol to automatically assign partitions, and manually assigning partitions with assign(). When you call assign() and pass a set of TopicPartition objects, you bind this consumer to those specific partitions and it will only consume from them. This bypasses the dynamic partition rebalancing that happens with subscribe(). It’s not about committing offsets automatically, closing the consumer, or creating a new consumer group—the latter two are done by other methods/properties. Therefore, the statement that best describes assign() is that it assigns partitions for the consumer to read from.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy