use of org.apache.samza.config.ConfigRewriter in project samza by apache.
the class ConfigUtil method applyRewriter.
/**
* Re-writes configuration using a ConfigRewriter, defined with the given rewriterName in config.
* @param config the config to re-write
* @param rewriterName the name of the rewriter to apply
* @return the rewritten config
*/
public static Config applyRewriter(Config config, String rewriterName) {
String rewriterClassName = new JobConfig(config).getConfigRewriterClass(rewriterName).orElseThrow(() -> new SamzaException(String.format("Unable to find class config for config rewriter %s.", rewriterName)));
ConfigRewriter rewriter = ReflectionUtil.getObj(rewriterClassName, ConfigRewriter.class);
LOG.info("Re-writing config with {}", rewriter);
return rewriter.rewrite(rewriterName, config);
}
Aggregations