Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Current stateUnder Discussion

Discussion thread: here TODO

JIRA: KAFKA-9525

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

...

Code Block
languagejava
Consumer {
	/**
     * @see KafkaConsumer#enforceRebalance()
     */
	void rejoinGroupenforceRebalance();
}

KafkaConsumer {
   /**
	* Alert the consumer to trigger a new rebalance by rejoining the group. You should not need to call this during normal processing,
	* as the consumer group will manage itself automatically and rebalance when necessary. However there may be situations where 
	* the application wishes to trigger a rebalance that would otherwise not occur, for example if some condition has changed that
	* has implications for the ideal partition assignment.
	* <p>
	* If a rebalance is already in progress, an exception will be thrown
	* so you can choose to retry or not once the current rebalance completes.
	* 
	* @throws java.lang.IllegalStateException if the consumer does not use group subscription
    * @throws org.apache.kafka.common.errors.RebalanceInProgressException if a rebalance is already in progress
	* @throws org.apache.kafka.common.errors.CoordinatorNotAvailableException if the coordinator is unknown/unavailable
	* @throws org.apache.kafka.common.KafkaException for any other unrecoverable errors (e.g. rebalance callback errors)
	*/ 
	public void rejoinGroupenforceRebalance() {}
}

Proposed Changes

This KIP proposes to add an API that will immediately trigger a rebalance (as in Consumer#unsubscribe) without revoking all currently owned partitions. Both static and dynamic members will attempt to rejoin the group. The intended behavior is fairly straightforward, but there are some edge cases to consider:

...