![JAR search and dependency download from the Maven repository](/logo.png)
io.wizzie.normalizer.funcs.MapperFunction Maven / Gradle / Ivy
package io.wizzie.normalizer.funcs;
import io.wizzie.metrics.MetricsManager;
import org.apache.kafka.streams.KeyValue;
import org.apache.kafka.streams.kstream.KeyValueMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
/**
* This class is used implement mapper process where you can transform one message into other
*/
public abstract class MapperFunction implements Function>>,
KeyValueMapper, KeyValue>> {
private final Logger log = LoggerFactory.getLogger(getClass());
/**
* Initialize mapper function
* @param properties Properties for mapper function
* @param metricsManager MetricsManager object for mapper function
*/
@Override
public void init(Map properties, MetricsManager metricsManager) {
prepare(properties, metricsManager);
log.info(" with {}", toString());
}
/**
* Apply mapper function to Key-Value Kafka message
* @param key The key of Kafka message
* @param value The value of Kafka message
* @return A Key-Value object after apply mapper function
*/
@Override
public KeyValue> apply(String key, Map value) {
return process(key, value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy