All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.navdeep.kafkaer.App Maven / Gradle / Ivy

Go to download

Deployment automation utility for apache kafka. Automate kafka cluster configurations for topics, brokers, ACLs. This jar can be used as an executable as well as a maven dependecy

The newest version!
package co.navdeep.kafkaer;

import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class App {
    public static void main(String[] a) throws Exception {
        Args args = new Args();
        CmdLineParser parser = new CmdLineParser(args);
        try {
            parser.parseArgument(a);
        } catch(CmdLineException e){
            throw new Exception("Invalid command line arguments", e);
        }
        if(args.isHelp()){
            parser.printUsage(System.out);
            return;
        }

        if(args.isDebug()){
            System.setProperty("org.slf4j.simpleLogger.log.co.navdeep", "debug");
        }
        Logger logger = LoggerFactory.getLogger(App.class);

        if(args.getProperties() == null || args.getConfig() == null) {
            throw new RuntimeException("Missing required arguments - propertiesLocation, configLocation");
        }

        logger.debug("Input args: config: [{}] properties: [{}] wipe:[{}] confirm-delete: [{}], wipe-schema: [{}], preserve-partition-count: [{}]", args.getConfig(), args.getProperties(), args.isWipe(), args.isConfirmDelete(), args.isWipeSchemas(), args.isPreservePartitionCount());
        Configurator configurator = new Configurator(args.getProperties(), args.getConfig());
        configurator.setPreservePartitionCount(args.isPreservePartitionCount());
        if(args.isWipe())
            configurator.wipeTopics(args.isConfirmDelete(), args.isWipeSchemas());
        else
            configurator.applyConfig();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy