I have some running consumers. I want to set the offset of a specific
topic-partition-group with a new consumer instance in the same group. I
have tried to use subscribe(), but kafka randomly assign partition to the
new consumer, I can't operate the partition I want. Then I tried to use
assign(), but when I tried to commit offset, I got exceptions :
"Error UNKNOWN_MEMBER_ID occurred while committing offsets for group
xxxxxxx" "Commit cannot be completed due to group rebalance".
The codes are:
consumer.poll(0);
consumer.seekToEnd(partition);
long endOffset = consumer.position( partition);
cosumer.commitSync(Collections.singletonMap(partition, new
OffsetAndMetadata(endOffset)));
I'm using kafka 0.9.0. Is there any way I can set offset correctly ?