For the following code I used
KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props);
consumer.subscribe(Arrays.asList(TOPIC));
TopicPartition partition = new TopicPartition(TOPIC, 0);
System.out.println(consumer.position(partition));
I received the error like the "You can only check the position for partitions assigned to this consumer.", what's wrong with the above code?