private <T> T getOrThrowException(
        final KafkaFuture<T> future,
        final long timeoutMs,
        final Supplier<String> errorMessage) {
        final Throwable cause;

        try {
            return future.get(timeoutMs, TimeUnit.MILLISECONDS);
        } catch (final java.util.concurrent.TimeoutException timeout) {
            throw new TimeoutException(errorMessage.get(), timeout);
        } catch (final ExecutionException exception) {
            cause = exception.getCause();
            if (cause instanceof TimeoutException) {
                throw (TimeoutException) cause;
            }
        } catch (final InterruptedException error) {
            cause = error;
        }

        throw new StreamsException(errorMessage.get(), cause);
    }
Returns the internal clients' assigned {@code client instance ids}.

@return The internal clients' assigned instance ids used for metrics collection.

@throws IllegalArgumentException If {@code timeout} is negative.
@throws IllegalStateException If {@code KafkaStreams} is not running.
@throws TimeoutException Indicates that a request timed out.
@throws StreamsException For any other error that might occur.
streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java