kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stevo Slavić <ssla...@gmail.com>
Subject New consumer - partitions auto assigned only on poll
Date Wed, 22 Jul 2015 09:09:18 GMT
Hello Apache Kafka community,

In the new consumer I encountered unexpected behavior. After constructing
KafakConsumer instance with configured consumer rebalance callback handler,
and subscribing to a topic with "consumer.subscribe(topic)", retrieving
subscriptions would return empty set and callback handler would not get
called (no partitions ever assigned or revoked), no matter how long
instance was up.

Then I found by inspecting KafkaConsumer code that partition assignment
will only be triggered on first poll, pollOnce has:

// ensure we have partitions assigned if we expect to
if (subscriptions.partitionsAutoAssigned())
    coordinator.ensurePartitionAssignment();

Would it make sense to include this fragment in KafkaConsumer.subscriptions
accessor as well?

Kind regards,
Stevo Slavic.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message