use of org.apache.kafka.streams.processor.internals.namedtopology.KafkaStreamsNamedTopologyWrapper in project kafka by apache.
the class IntegrationTestUtils method getStateListener.
private static StateListener getStateListener(final KafkaStreams streams) {
try {
if (streams instanceof KafkaStreamsNamedTopologyWrapper) {
final Field field = streams.getClass().getSuperclass().getDeclaredField("stateListener");
field.setAccessible(true);
return (StateListener) field.get(streams);
} else {
final Field field = streams.getClass().getDeclaredField("stateListener");
field.setAccessible(true);
return (StateListener) field.get(streams);
}
} catch (final IllegalAccessException | NoSuchFieldException e) {
throw new RuntimeException("Failed to get StateListener through reflection", e);
}
}
Aggregations