DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
| Table of Contents |
|---|
Status
Current state: Under Discussion Accepted
Discussion thread: https://lists.apache.org/thread/t4h273md03vzcbzk4r3bn86km8rnym66
Vote thread: https://lists.apache.org/thread/j0ol8tk2fdyk0bk6x859yw5dtjh8h1xc
JIRA: Jira server ASF JIRA serverId 5aa69414-a9e9-3523-82ec-879b028fb15b key KAFKA-20167
...
- Classic Protocol:
REMAIN_IN_GROUPbehaves as expected, the member stays in the consumer group, enabling a faster rebalance upon restart. - Streams Protocol (KIP-1071), dynamic member: The member unconditionally leaves the group regardless of this setting, since remaining in the group provides no benefit for non-static members under the new protocol.
- Streams Protocol (KIP-1071), static member: The member should remain in the group by default. Static membership is explicitly configured to reduce rebalance disruption on restart, and leaving the group on close would significantly reduce the benefit of static membership.. Notably, the underlying consumer already differentiates close semantics based on membership type, making this behavior both natural and consistent.
To resolve this ambiguity and provide a cleaner API for the long term, we should introduce a new enum value: CloseOptions.DEFAULT. This allows the "default" behavior to be adaptive based on the underlying protocol, while strictly reserving REMAIN_IN_GROUP for when the user explicitly requests that intent regardless of protocol or membership type.
Public Interfaces
The following public API is affected:
...
- Classic Protocol → maps to Consumer
CloseOptions.REMAIN_IN_GROUP(preserves existing behavior; no regression for current users). Streams Protocol (KIP-1071)
→ , dynamic member →
DEFAULTmaps to Consumer consumer
DEFAULT, causing the member to leave the group, since remaining provides no benefit.Streams Protocol (KIP-1071), static member → maps to Consumer REMAIN_IN_GROUP, preserving static membership and avoiding unnecessary rebalances on restart. This is consistent with the consumer, which already differentiates close semantics based on membership type.
CloseOptions.DEFAULT (leaves the group for dynamic members, consistent with protocol design)4. Redefine CloseOptions.REMAIN_IN_GROUP
...
Currently, the Streams Protocol implementation in StreamsGroupHeartbeatManager does not honor REMAIN_IN_GROUP. This gap must be addressed as part of this KIP to ensure the option functions correctly end-to-end under KIP-1071: Streams Rebalance Protocol#Compatibility,DeprecationandMigrationPlan.
Behavior Matrix
| Streams CloseOption | Classic Protocol |
|---|
| (Dynamic Member) | Classic Protocol (Static Member) | Streams Protocol (Dynamic Member) | Streams Protocol |
|---|
| (Static Member) | ||||
|---|---|---|---|---|
| close() (current) [1] | Consumer REMAIN | Consumer REMAIN | Consumer LEAVE | N/A |
| close() (new) [2] | Consumer REMAIN | Consumer REMAIN | Consumer DEFAULT (LEAVE) | Consumer DEFAULT (REMAIN) |
| close(REMAIN_IN_GROUP) (current) | Consumer REMAIN | Consumer REMAIN | Consumer LEAVE | N/A |
| close( |
| REMAIN_IN_GROUP |
| ) (new) | Consumer REMAIN | Consumer REMAIN | Consumer REMAIN |
| Consumer |
| REMAIN |
| close(LEAVE_GROUP |
| ) (current) | Consumer LEAVE | Consumer LEAVE | Consumer LEAVE | N/A |
| close(LEAVE_GROUP) (new) | Consumer LEAVE | Consumer LEAVE | Consumer LEAVE | Consumer LEAVE |
Legend:
close()(current) internally delegates toclose(REMAIN_IN_GROUP)close()(new) internally delegates toclose(DEFAULT)
Compatibility, Deprecation, and Migration Plan
- Classic Protocol users: No behavioral change.
KafkaStreams.close()continues to result in the member remaining in the group, as before. - Streams Protocol users (dynamic member): The behavior of the no-arg
close()becomes cleaner and consistent with the protocol's design intent. Users who explicitly needREMAIN_IN_GROUPsemantics under the Streams Protocol must now pass that option explicitly. - Streams Protocol users (static member): The behavior of the no-arg
close()now correctly honors static membership semantics — the member remains in the group by default. - Streams Protocol users (explicit REMAIN_IN_GROUP): This is a behavioral change worth calling out explicitly. Prior to this KIP, REMAIN_IN_GROUP was silently ignored under the Streams Protocol, and the member would always leave the group. After this KIP, the option will be correctly honored. We consider this a bug fix rather than an intentional design change and expect very few users to be affected in practice.
- No existing enum values are removed or deprecated. The new
DEFAULTvalue is purely additive.
...