You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "lucasbru (via GitHub)" <gi...@apache.org> on 2026/02/09 14:14:12 UTC
[PR] MINOR: Document that REMAIN_IN_GROUP is ignored with streams protocol [kafka]
lucasbru opened a new pull request, #21433:
URL: https://github.com/apache/kafka/pull/21433
## Summary
When using the streams group protocol (`group.protocol=streams`), the consumer always leaves the group on close, regardless of whether `REMAIN_IN_GROUP` was specified. This differs from the classic protocol behavior where the consumer does not leave the group explicitly by default.
This PR documents this behavior in the javadocs for `CloseOptions.GroupMembershipOperation`, `KafkaStreams.close()`, and `KafkaStreams.close(Duration)`, and adds an INFO log message when a close occurs with the streams protocol to inform users about this behavior.
## Test plan
- Verified checkstyle and spotlessCheck pass
- Documentation-only changes with minor log addition
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Document that REMAIN_IN_GROUP is ignored with streams protocol [kafka]
Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on code in PR #21433:
URL: https://github.com/apache/kafka/pull/21433#discussion_r2795101117
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java:
##########
@@ -1879,6 +1879,9 @@ private void completeShutdown(final boolean cleanRun) {
try {
final GroupMembershipOperation membershipOperation =
leaveGroupRequested.get() == org.apache.kafka.streams.CloseOptions.GroupMembershipOperation.LEAVE_GROUP ? LEAVE_GROUP : REMAIN_IN_GROUP;
+ if (membershipOperation == REMAIN_IN_GROUP && streamsRebalanceData.isPresent()) {
Review Comment:
Thanks. If we have this pattern already, maybe not worth to to a larger change... I understand the redundancy argument; so overall not sure what the best thing would be. Maybe it doesn't matter too much overall.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Document that REMAIN_IN_GROUP is ignored with streams protocol [kafka]
Posted by "lucasbru (via GitHub)" <gi...@apache.org>.
lucasbru merged PR #21433:
URL: https://github.com/apache/kafka/pull/21433
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Document that REMAIN_IN_GROUP is ignored with streams protocol [kafka]
Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on code in PR #21433:
URL: https://github.com/apache/kafka/pull/21433#discussion_r2785059538
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java:
##########
@@ -1879,6 +1879,9 @@ private void completeShutdown(final boolean cleanRun) {
try {
final GroupMembershipOperation membershipOperation =
leaveGroupRequested.get() == org.apache.kafka.streams.CloseOptions.GroupMembershipOperation.LEAVE_GROUP ? LEAVE_GROUP : REMAIN_IN_GROUP;
+ if (membershipOperation == REMAIN_IN_GROUP && streamsRebalanceData.isPresent()) {
Review Comment:
Not 100% sure about re-using `streamsRebalanceData.isPresent()` -- Sure it works, but is it "clean"?
Should we rather introduce a member-variable (eg `GroupProtocol rebalanceProtocol`)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Document that REMAIN_IN_GROUP is ignored with streams protocol [kafka]
Posted by "lucasbru (via GitHub)" <gi...@apache.org>.
lucasbru commented on code in PR #21433:
URL: https://github.com/apache/kafka/pull/21433#discussion_r2792380669
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java:
##########
@@ -1879,6 +1879,9 @@ private void completeShutdown(final boolean cleanRun) {
try {
final GroupMembershipOperation membershipOperation =
leaveGroupRequested.get() == org.apache.kafka.streams.CloseOptions.GroupMembershipOperation.LEAVE_GROUP ? LEAVE_GROUP : REMAIN_IN_GROUP;
+ if (membershipOperation == REMAIN_IN_GROUP && streamsRebalanceData.isPresent()) {
Review Comment:
The pattern `streamsRebalanceData.isPresent()` is already used throughout this file to check for the streams protocol (lines 1122, 1128, 1178, 1332, 1503). Introducing a separate `GroupProtocol` member variable would add redundancy since `streamsRebalanceData` is only populated when using the streams protocol.
If you think we should change the pattern, it would be a larger cleanup across the file. Happy to do that as a separate PR if you prefer, but for this minor doc change I'd prefer to stay consistent with the existing pattern.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org