As a stop-gap you can create something like the following. private static boolean isClosed(KafkaConsumer<String, String> consumer) { try { var consumerClass = consumer.getClass(); Field field = consumerClass.getDeclaredField("closed"); field.setAccessible(true); return (Boolean) field.get(consumer); } catch (NoSuchFieldException | IllegalAccessException e) { throw new RuntimeException(e); } }
On Mon, May 29, 2023 at 2:11 AM Eric Li <e...@lexidus.com> wrote: > Hello everyone, my question is as the topic. > > In particular, when I have a Consumer object, I would like to see if > > https://github.com/apache/kafka/blob/2e1947d240607d53f071f61c875cfffc3fec47fe/clients/src/main/java/org/apache/kafka/clients/consumer/Consumer.java#L269 > (kafka-clients-3.4.0 > <https://github.com/apache/kafka/blob/2e1947d240607d53f071f61c875cfffc3fec47fe/clients/src/main/java/org/apache/kafka/clients/consumer/Consumer.java#L269(kafka-clients-3.4.0>) > has been called. Is it possible? >