io.quarkus.kafka.streams.runtime.HotReplacementInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-kafka-streams Show documentation
Show all versions of quarkus-kafka-streams Show documentation
Implement stream processing applications based on Apache Kafka
package io.quarkus.kafka.streams.runtime;
import java.util.Map;
import org.apache.kafka.clients.consumer.ConsumerInterceptor;
import org.apache.kafka.clients.consumer.ConsumerRecords;
public class HotReplacementInterceptor implements ConsumerInterceptor {
private static volatile Runnable onMessage;
@Override
public void configure(Map configs) {
}
@Override
public ConsumerRecords onConsume(ConsumerRecords records) {
if (onMessage != null) {
onMessage.run();
}
return records;
}
@Override
public void onCommit(Map offsets) {
}
@Override
public void close() {
}
public static void onMessage(Runnable handler) {
onMessage = handler;
}
}