Search in sources :

Example 1 with EmbeddedElasticSearch

use of com.netflix.conductor.elasticsearch.EmbeddedElasticSearch in project conductor by Netflix.

the class Main method main.

public static void main(String[] args) throws Exception {
    BootstrapUtil.loadConfigFile(args.length > 0 ? args[0] : System.getenv("CONDUCTOR_CONFIG_FILE"));
    if (args.length == 2) {
        System.out.println("Using log4j config " + args[1]);
        PropertyConfigurator.configure(new FileInputStream(new File(args[1])));
    }
    Injector bootstrapInjector = Guice.createInjector(new BootstrapModule());
    ModulesProvider modulesProvider = bootstrapInjector.getInstance(ModulesProvider.class);
    Injector serverInjector = Guice.createInjector(modulesProvider.get());
    Optional<EmbeddedElasticSearch> embeddedElasticSearch = serverInjector.getInstance(EmbeddedElasticSearchProvider.class).get();
    embeddedElasticSearch.ifPresent(BootstrapUtil::startEmbeddedElasticsearchServer);
    BootstrapUtil.setupIndex(serverInjector.getInstance(IndexDAO.class));
    try {
        serverInjector.getInstance(IndexDAO.class).setup();
    } catch (Exception e) {
        e.printStackTrace(System.err);
        System.exit(3);
    }
    BootstrapUtil.configureSummaryUtil(serverInjector.getInstance(Configuration.class));
    System.out.println("\n\n\n");
    System.out.println("                     _            _             ");
    System.out.println("  ___ ___  _ __   __| |_   _  ___| |_ ___  _ __ ");
    System.out.println(" / __/ _ \\| '_ \\ / _` | | | |/ __| __/ _ \\| '__|");
    System.out.println("| (_| (_) | | | | (_| | |_| | (__| || (_) | |   ");
    System.out.println(" \\___\\___/|_| |_|\\__,_|\\__,_|\\___|\\__\\___/|_|   ");
    System.out.println("\n\n\n");
    Optional<GRPCServer> grpcServer = serverInjector.getInstance(GRPCServerProvider.class).get();
    grpcServer.ifPresent(BootstrapUtil::startGRPCServer);
    serverInjector.getInstance(JettyServerProvider.class).get().ifPresent(server -> {
        try {
            server.start();
        } catch (Exception ioe) {
            ioe.printStackTrace(System.err);
            System.exit(3);
        }
    });
}
Also used : GRPCServerProvider(com.netflix.conductor.grpc.server.GRPCServerProvider) Configuration(com.netflix.conductor.core.config.Configuration) EmbeddedElasticSearchProvider(com.netflix.conductor.elasticsearch.EmbeddedElasticSearchProvider) FileInputStream(java.io.FileInputStream) IndexDAO(com.netflix.conductor.dao.IndexDAO) GRPCServer(com.netflix.conductor.grpc.server.GRPCServer) EmbeddedElasticSearch(com.netflix.conductor.elasticsearch.EmbeddedElasticSearch) Injector(com.google.inject.Injector) File(java.io.File)

Aggregations

Injector (com.google.inject.Injector)1 Configuration (com.netflix.conductor.core.config.Configuration)1 IndexDAO (com.netflix.conductor.dao.IndexDAO)1 EmbeddedElasticSearch (com.netflix.conductor.elasticsearch.EmbeddedElasticSearch)1 EmbeddedElasticSearchProvider (com.netflix.conductor.elasticsearch.EmbeddedElasticSearchProvider)1 GRPCServer (com.netflix.conductor.grpc.server.GRPCServer)1 GRPCServerProvider (com.netflix.conductor.grpc.server.GRPCServerProvider)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1