Search in sources :

Example 1 with OciAutonomousDbRx

use of io.helidon.integrations.oci.atp.OciAutonomousDbRx in project helidon by oracle.

the class OciAtpMain method main.

/**
 * Application main entry point.
 *
 * @param args command line arguments.
 */
public static void main(String[] args) {
    // load logging configuration
    LogConfig.configureRuntime();
    // By default this will pick up application.yaml from the classpath
    Config config = Config.create();
    Config ociConfig = config.get("oci");
    // this requires OCI configuration in the usual place
    // ~/.oci/config
    OciAutonomousDbRx autonomousDbRx = OciAutonomousDbRx.create(ociConfig);
    // Prepare routing for the server
    WebServer server = WebServer.builder().config(config.get("server")).routing(Routing.builder().register("/atp", new AtpService(autonomousDbRx, config))).build();
    // Start the server and print some info.
    server.start().thenAccept(ws -> {
        System.out.println("WEB server is up! http://localhost:" + ws.port() + "/");
    });
    // Server threads are not daemon. NO need to block. Just react.
    server.whenShutdown().thenRun(() -> System.out.println("WEB server is DOWN. Good bye!"));
}
Also used : WebServer(io.helidon.webserver.WebServer) Config(io.helidon.config.Config) LogConfig(io.helidon.common.LogConfig) OciAutonomousDbRx(io.helidon.integrations.oci.atp.OciAutonomousDbRx)

Aggregations

LogConfig (io.helidon.common.LogConfig)1 Config (io.helidon.config.Config)1 OciAutonomousDbRx (io.helidon.integrations.oci.atp.OciAutonomousDbRx)1 WebServer (io.helidon.webserver.WebServer)1