BT

InfoQ Homepage News Helidon 2.0 Features New Web Client, DB Client and Command-Line Tool

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

Bookmarks

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 Server, Configuration 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 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.

Developers can now create, build and run Helidon applications via the command line with the new Helidon CLI tool. Similar to hot reloading provided by Quarkus (quarkus:dev), a built-in development loop, known as devloop, monitors source files that triggers a restart of the application upon changes to the source code. A separate download is required. Once installed, the available command-line options are shown below:

Dmitry Kornilov, director of software development at Oracle, spoke to infoQ about this latest release.

InfoQ: What do you feel is the most significant new feature in Helidon 2.0?

Dmitry Kornilov: We added many new features in Helidon such as Helidon DB Client for non-blocking database access, support for reactive streams operators and messaging, Helidon WebClient for calling other services in a non-blocking way, CORS support and more.

But the main big feature is, of course, GraalVM native-image support in Helidon MP. Now our users can take advantage of GraalVM native images such as almost immediate startup and low memory consumption in their Helidon MP applications.

InfoQ: How was the Helidon team able to overcome the reflection issue that originally prevented Helidon MP applications from being converted to native code with GraalVM?

Kornilov: The main blocker was CDI which uses runtime operations that are not GraalVM native-image friendly. We spent a lot of time to successfully tune Weld to make it process most of runtime operations at compile time. It works even with CDI extensions.

But users need to be sure that third-party CDI extensions are native-image friendly. If not, the application cannot be compiled to the native image until these issues are resolved. We've done some work testing Helidon components and some third-party components for native-image compatibility. The full list of supported and fully-tested components can be found here. We are continuously working on expanding this list.

Our users can help us by testing components they use and informing us if it doesn't work with GraalVM native-image. We'll include them on the list and will try to make them compatible.

InfoQ: It would appear that Helidon and Micronaut have recently been offering similar new features and tools, e.g, CLI. Would you consider Micronaut a viable competitor in the microframeworks space and what would you say makes Helidon SE unique over Micronaut?

Kornilov: Micronaut is a great framework. Currently, it is more feature-rich than Helidon and it supports AOT compilation by design, which makes it a perfect showcase of GraalVM native-image.

Helidon MP, on the other hand, is our "standards" solution. It supports MicroProfile and some Jakarta EE components. Micronaut doesn't support it because of AOT compilation limitations. We also have Helidon SE, which offers another development experience and allows building fast, reactive, non-blocking services.

We are planning to embrace Micronaut and combine the best of both worlds.

InfoQ: Now that Helidon 2.0 has been released, what's on the horizon for Helidon?

Kornilov: I already unveiled our efforts on a Helidon+Micronaut integration. Besides that, we are planning to add support for the latest MicroProfile versions, implement the MicroProfile Long-Running Actions (LRA) and GraphQL specifications, and work hard on improving performance and stability.

For more details, developers can watch the replay of the Oracle Live Webcast and view the corresponding slide deck.

Resources

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.