In a recent Oracle Live Webcast, Oracle formally released Helidon 2.0 and announced that Coherence, Oracle’s in-memory data grid solution, will be open-sourced. Helidon 2.0 ships with a host of new significant features such as: support for reactive messaging and streams; a new command-line tool, a new web client API for Helidon SE, GraalVM support for Helidon MP, and a new reactive database client.

Helidon, a Greek word for a swallow, is an open-source framework and collection of Java libraries designed for creating microservices-based applications. There are two versions: Helidon SE provides core functional-style APIs for building microservices-based applications. An application server is not required; Helidon MP is an implementation of the MicroProfile specification for building microservices-based applications. A full list of supported APIs for Helidon SE and Helidon MP is available.

To complement the original three core Helidon SE APIs - Web ServerConfiguration and Security - a new Web Client API completes the set for Helidon SE. Web Client processes HTTP requests and responses related to a specified endpoint. Consider this small example where an instance of the [**WebClient**](https://helidon.io/docs/2.0.0/apidocs/io.helidon.webclient/io/helidon/webclient/WebClient.html) interface is built along with a response that returns plain text:

WebClient client = WebClient.builder()
        .baseUri("http://localhost")
        .build();

CompletionStage<String> response = webClient.get()
        .path("/endpoint")
        .request(String.class);

Note that the **response** instance variable is of type **CompletionStage<String>**. Built on top of Netty, Helidon’s Web Server is an asynchronous and reactive API and the new Web Client API was designed to be the same.

To address the challenges associated with reactive applications connecting to JDBC databases that, by design, are non-reactive, Helidon 2.0 introduces the new DB Client that provides consistent reactive database access and queries for Helidon SE applications. DB Client supports relational databases that connect via JDBC and reactive drivers for MongoDB. This new API features the ability to specify database connections and write native query code in a configuration file such that making database-related changes can easily be made without having to recompile code:

db:
  source: "jdbc"
  connection:
    url: "jdbc:mysql://127.0.0.1:3306/pokemon?useSSL=false"
    username: "user"
    password: "password"
    poolName: "mysql"
  statements:
    ping: "DO 0"
    select-all-pokemons: "SELECT id, name FROM Pokemons"

Support for metrics, health checks and tracing in DB Client is also included. The Helidon team has created this example application to demonstrate how to use this new feature.

Support for GraalVM, introduced with the release of Helidon 1.0.3, was only available for Helidon SE applications. Helidon MP applications could not take advantage of GraalVM due to the use of reflection within CDI. As one of the most requested features by the Java community, Helidon 2.0 now supports converting Helidon MP applications to native executable code with GraalVM. Tomas Langer, consulting member of technical staff at Oracle, has created this demo application and this YouTube video to demonstrate how to use this new feature.

#helidon #java #graalvm #development #architecture & design #devops #news

Helidon 2.0 Features New Web Client, DB Client and Command-Line Tool
9.45 GEEK