Helidon Takes Flight

Today is a great day. Today we introduce a new Java microservices framework and a new member of the MicroProfile family. Please welcome Project Helidon — a new open source Java microservices framework from Oracle.

Helidon is a Greek word for swallow, a type of bird that according to Wikipedia has “a slender, streamlined body and long pointed wings, which allow great manoeuvrability and… very efficient flight”. Perfect for darting through the clouds.

Overview

The work on what would become the Helidon Project started some time ago. When we entered the cloud world, and microservices architecture started to become very popular for creating cloud services, we realized that the development experience also needed to change. It’s possible to build microservices using Java EE, but it’s better to have a framework designed from the ground up for building microservices. We wanted to create a lightweight set of libraries that didn’t require an application server and could be used in Java SE applications. These libraries could be used separately from each other, but when used together would provide the foundation a developer needs to create a microservice: configuration, security, and a web server.

There are already some efforts to build standard microservices frameworks from MicroProfile. MicroProfile is quite popular in the Java EE/Jakarta EE community and provide a development experience similar to Java EE. We like the idea and support the initiative. Helidon implements MicroProfile 1.1. We will continue working on implementing new versions of MicroProfile and intend to support relevant Jakarta EE standards in this area as they are defined.

Helidon is made by Oracle, so don’t be surprised that there will be some useful Oracle Cloud integrations. These are not included in the initial version, but will be added later. Helidon is already used by many internal Oracle projects and these integrations simplify our developers’ lives big time. We believe that will simplify your life as well if you use Oracle Cloud. If not, these integrations are optional.

Landscape

Microservices frameworks categories

Java Frameworks for writing microservices fall into a few categories. From smaller to larger:

  • Microframeworks
    Simple, fun, intentionally small feature set. Examples are Spark, Javalin, Micronaut, etc.
  • MicroProfile
    Friendly to Java EE developers but a bit heavier. Some of them are build on top of fully featured Java EE application servers. Examples are Thorntail (was Wildfly Swarm), OpenLiberty, Payara.
  • Full Stack
    Fuller features set such as Spring Boot.

Helidon comes in two flavours and covers two categories — Microframeworks and MicroProfile. It’s up to a developer to choose what to use in their applications.

  • Helidon SE — simple, functional, lightweight microframework developed in a modern reactive way. There is no injection “magic”. No special runtime required. JDK is used as runtime.
  • Helidon MP — Eclipse Microprofile implementation providing development experience familiar to Java EE/Jakarta EE developers.

Architecture

Helidon’s high level architecture is shown on the picture below.

Helidon architecture
  • Helidon SE components are marked green. These are Config, Security and RxServer.
  • The Java EE/Jakarta EE components we use are marked grey. These are JSON-P, JAX-RS/Jersey and CDI. These components are required for MicroProfile implementation.
  • Helidon MP is a thin layer on top of Helidon SE components.
  • Optional Oracle Cloud services components are marked red and used in both Helidon SE and Helidon MP.

Usage and Samples

Setup

The easiest way to start using Helidon is if you use a Maven project with Java 8 (or higher version) and configure the Helidon bom-pom:

Helidon SE

Helidon SE is the base to build lightweight reactive microservices.

A Hello world implementation:

This would start webserver on a random (free) port and expose endpoint /hello.

Imports
Dependency needed to start this example (version not required if you used bom-pom)

Adding metrics to SE

We have provided an implementation of MicroProfile Metrics interfaces also for Helidon SE (without support for injection, as that is not included in SE).

This requires a new dependency:

New endpoints are available:

  • /metrics 
    All metrics (base, vendor and application)
  • /metrics/application/helloCounter
    The metric created in our hello world application

Helidon MP

Helidon MP is an Eclipse Microprofile implementation and a runtime for microservices.

A Hello world implementation that uses metrics to meter the invocations.

You must create a JAX-RS resource class to process your requests:

And then start the server with this resource:

You also need to create beans.xml file in the src/main/resources/META-INF directory to trigger CDI injection in this project:

This would start a webserver on the default port (7001) and expose endpoint “/hello”.

The following endpoints are available:

  • The hello world example
    http://localhost:7001/hello
  • MicroProfile Metrics endpoin
    thttp://localhost:7001/metrics
  • The metric of our endpoint
    http://localhost:7001/metrics/application/com.oracle.tlanger.HelloWorld.hello
  • MicroProfile Health endpoin
    thttp://localhost:7001/health

Plans

We have so many plans, I could write a separate article about them.

Our short term goal is to advertise Helidon in the Java community. We are planning to talk about Helidon at some conferences. We have four Helidon-related Oracle Code One 2018 talks planned. We have also submitted talks to EclipseCon Europe 2018 and will participate in the Jakarta EE/MicroProfile Community Day there. Some learning materials such as such as videos, samples, articles, etc. are also on the way.

From the technical perspective, we are working on implementing the next MicroProfile versions. We are also working on GraalVM support, which looks like a great feature for Helidon SE users.

We are working on some other cool stuff and features, but we can’t show all cards now. Stay tuned, we will announce new features as soon as the are ready.

Useful Links

You may find it interesting

  • The original internal name of the project was J4C (Java for Cloud).
  • The Helidon development is distributed between a team in Prague and a team in the US.
  • Helidon is already used in more than 10 projects within Oracle.
  • Some Helidon components are still in development and will be open sourced at some point in time.
Like what you read? Give Dmitry Kornilov a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.