David Hay created KAFKA-8949:
--------------------------------
Summary: MockConsumer.assign and ConsumerRebalanceListener
Key: KAFKA-8949
URL: https://issues.apache.org/jira/browse/KAFKA-8949
Project: Kafka
Issue Type: Bug
Reporter: David Hay
Using MockConsumer, one must either use {{assign}} or {{subscribe}}, not both.
However, if you decide to use the {{assign}} method, there is not an easy way
to register a ConsumerPartitionListener that will get called when {{assign}} is
called. The current work around is to do the following:
{code:java}
MockConsumer consumer = new MockConsumer();
consumer.subscribe(Collections.singletonList("test.topic"), listener);
consumer.unsubscribe();
consumer.assign(Arrays.asList(new TopicPartition("test.topic", 1), ...)){code}
Would be nice to do something like:
{code:java}
MockConsumer consumer = new MockConsumer();
consumer.registerRebalanceListener();
consumer.assign(...){code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)