dajac commented on code in PR #12035:
URL: https://github.com/apache/kafka/pull/12035#discussion_r858303688


##########
streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java:
##########
@@ -1498,6 +1516,37 @@ public synchronized boolean close(final Duration 
timeout) throws IllegalArgument
         return close(timeoutMs);
     }
 
+    /**
+     * Shutdown this {@code KafkaStreams} by signaling all the threads to 
stop, and then wait up to the timeout for the
+     * threads to join.
+     * @param options  contains timeout to specify how long to wait for the 
threads to shutdown, and a flag leaveGroup to
+     *                 trigger consumer leave call
+     * @return {@code true} if all threads were successfully 
stopped—{@code false} if the timeout was reached
+     * before all threads stopped
+     * Note that this method must not be called in the {@link 
StateListener#onChange(KafkaStreams.State, KafkaStreams.State)} callback of 
{@link StateListener}.
+     * @throws IllegalArgumentException if {@code timeout} can't be 
represented as {@code long milliseconds}
+     */
+    public synchronized boolean close(final CloseOptions options) throws 
IllegalArgumentException {
+        final String msgPrefix = 
prepareMillisCheckFailMsgPrefix(options.timeout, "timeout");
+        final long timeoutMs = validateMillisecondDuration(options.timeout, 
msgPrefix);
+        if (timeoutMs < 0) {
+            throw new IllegalArgumentException("Timeout can't be negative.");
+        }
+
+        if (options.leaveGroup) {
+            log.debug("Sending leave group trigger to removing instance from 
consumer group");
+            //removing instance from consumer group
+            adminClient.removeMembersFromConsumerGroup(

Review Comment:
   That makes sense, thanks.



-- 
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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to