nerdexam
Confluent

CCDAK · Question #60

A consumer wants to read messages from partitions 0 and 1 of a topic topic1. Code snippet is shown below. consumer.subscribe(Arrays.asList("topic1")); List<TopicPartition> pc = new ArrayList<>(); pc.a

Sign in or unlock CCDAK to reveal the answer and full explanation for question #60. The question stem and answer options stay visible for context.

Developing Kafka Consumers

Question

A consumer wants to read messages from partitions 0 and 1 of a topic topic1. Code snippet is shown below. consumer.subscribe(Arrays.asList("topic1")); List<TopicPartition> pc = new ArrayList<>(); pc.add(new PartitionTopic("topic1", 0)); pc.add(new PartitionTopic("topic1", 1)); consumer.assign(pc);

Options

  • AThis works fine. subscribe() will subscribe to the topic and assign() will assign partitions to the
  • BThrows IllegalStateException

Unlock CCDAK to see the answer

You've previewed enough free CCDAK questions. Unlock CCDAK for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#subscribe#assign#IllegalStateException#consumer API
Full CCDAK Practice