nandini created KAFKA-13220:
-------------------------------
Summary: Group or Group Coordinator logs are misleading when using
assign(partitions) method in Consumer API.
Key: KAFKA-13220
URL: https://issues.apache.org/jira/browse/KAFKA-13220
Project: Kafka
Issue Type: Bug
Components: clients
Reporter: nandini
Kafka console consumer does not allow us to to use group and partition together
https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/tools/ConsoleConsumer.scala#L395
Hence, on Manual topic assignment through this method does not use the
consumer's group management functionality.
https://kafka.apache.org/26/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#assign-java.util.Collection-
But as when using the API and implementing your own Kafka Consumer, you can
specify group.id and use consumer.assign(partitions);
While gives an impression that the client is using the group (however it is not
printed as an active consumer in kafka-consumer-groups describe output for that
topic)
Even if you do not specify a group.id it prints logs from GroupCoordinator
This is misleading.
{{Code- }}
{quote}{{Properties props = new Properties();}}
{{ props.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
bootstrapServers);}}
{{ props.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
StringDeserializer.class.getName());}}
{{ props.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
ByteArrayDeserializer.class.getName());}}
{{ props.setProperty(ConsumerConfig.GROUP_ID_CONFIG,
mygroup);}}{{List<TopicPartition> partitions = new
ArrayList<TopicPartition>();}}
{{ partitions.add(new TopicPartition("mytopic", 0));}}
{{ consumer.assign(partitions);}}
{quote}
{{Logs -}}
{{-- when group.id is specified}}
{quote}[main] INFO org.apache.kafka.clients.consumer.internals.Fetcher -
[Consumer clientId=consumer-1, groupId=mygroup] Resetting offset for partition
mytopic-0 to offset 0.
[main] INFO com.cloudera.kafka.SimpleConsumer - Key: null, Value: [B@7bc1a03d
[main] INFO com.cloudera.kafka.SimpleConsumer - Partition: 0, Offset:0
{quote}
-- when group.id is not specified
{quote}[main] INFO
org.apache.kafka.clients.consumer.internals.AbstractCoordinator - [Consumer
clientId=consumer-1, groupId=] Discovered group coordinator hostname:9092 (id:
2147483647 rack: null)
[main] INFO org.apache.kafka.clients.consumer.internals.Fetcher - [Consumer
clientId=consumer-1, groupId=] Resetting offset for partition mytopic-0 to
offset 0.
{quote}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)