I think you may have stumbled upon this: https://issues.apache.org/jira/browse/KAFKA-4881. 1 thing that you could try is using static membership - we have yet to try that though so can't comment yet on how that might work out.
On Thu, Aug 12, 2021 at 11:29 PM c...@uweeisele.eu <c...@uweeisele.eu> wrote: > Hello all, > > I have a question about the Group Membership lifecycle of Kafka Streams, > or more specific about when Kafka Streams does leave the consumer group (in > case of dynamic membership). > > My expectation was, that a call to the method KafkaStreams.close() also > sends a LeaveGroup request to the coordination (if dynamic membership is > used). However, its seems that this is not the case (at least in my case > the request was not send). Only if I explicitly call > KafkaStreams.removeStreamThread() a LeaveGroup request is sent to the > coordinator. I used the WordCount example located in > https://github.com/confluentinc/kafka-streams-examples to evaluate this. > > Is this how Kafka Streams is intended to work and if yes, what do you > recommend to achieve that Kafka Streams leaves the group when shutting down > the application? For example, one situation where I don't want to wait for > the session timeout is when downscaling an application. > > Thanks. > > Best Regards, > Uwe