Search in sources :

Example 1 with MovieRepository

use of io.helidon.examples.integrations.neo4j.se.domain.MovieRepository in project helidon by oracle.

the class Main method createRouting.

/**
 * Creates new Routing.
 *
 * @return routing configured with JSON support, a health check, and a service
 * @param config configuration of this server
 */
private static Routing createRouting(Config config) {
    MetricsSupport metrics = MetricsSupport.create();
    Neo4j neo4j = Neo4j.create(config.get("neo4j"));
    // registers all metrics
    Neo4jMetricsSupport.builder().driver(neo4j.driver()).build().initialize();
    Neo4jHealthCheck healthCheck = Neo4jHealthCheck.create(neo4j.driver());
    Driver neo4jDriver = neo4j.driver();
    MovieService movieService = new MovieService(new MovieRepository(neo4jDriver));
    HealthSupport health = HealthSupport.builder().addLiveness(// Adds a convenient set of checks
    HealthChecks.healthChecks()).addReadiness(healthCheck).build();
    return Routing.builder().register(// Health at "/health"
    health).register(// Metrics at "/metrics"
    metrics).register(movieService).build();
}
Also used : Neo4jHealthCheck(io.helidon.integrations.neo4j.health.Neo4jHealthCheck) Neo4j(io.helidon.integrations.neo4j.Neo4j) MovieRepository(io.helidon.examples.integrations.neo4j.se.domain.MovieRepository) HealthSupport(io.helidon.health.HealthSupport) Driver(org.neo4j.driver.Driver) Neo4jMetricsSupport(io.helidon.integrations.neo4j.metrics.Neo4jMetricsSupport) MetricsSupport(io.helidon.metrics.MetricsSupport)

Aggregations

MovieRepository (io.helidon.examples.integrations.neo4j.se.domain.MovieRepository)1 HealthSupport (io.helidon.health.HealthSupport)1 Neo4j (io.helidon.integrations.neo4j.Neo4j)1 Neo4jHealthCheck (io.helidon.integrations.neo4j.health.Neo4jHealthCheck)1 Neo4jMetricsSupport (io.helidon.integrations.neo4j.metrics.Neo4jMetricsSupport)1 MetricsSupport (io.helidon.metrics.MetricsSupport)1 Driver (org.neo4j.driver.Driver)1