Since about 2021 all JavaEE specifications moved from javax to jakarta packages which broke basically the full Java ecosystem. In the mean time, the industry became more cloud and Kubernetes focus which triggers new challenges like being native/GraalVM friendly. From the two strong statements, being vendor agnostic and light, Yupiik created Fusion !

Why Yupiik Fusion?

At Yupiik, we created an api platform and decided to open source the kernel of our product and share it with the community because we are heavily involved in open source projects.

What is Yupiik Fusion?

Yupiik Fusion is a very light weight and powerful framework to build cloud native microservices. It means that you have all your need to build the most common use cases in an efficient way by using your favorite programming language (Java).

For cloud applications, being the most reactive possible is a key criteria so Fusion chose to:

  • Be build time oriented : only delegate to runtime the bean resolution (to enable dynamic module aggregation) and not the bean and model discovery nor proxy generation,

  • Stay flexible : even if the model is generated at build time you can generally still customize it by removing a bean and adding your own one,

  • Be native friendly : some applications need to be native to start very fast and bypass the classloading and a bunch of JVM init, for that purpose we ensure the framework is GraalVM friendly - using Apache Geronimo Arthur or not.

The framework come with the most common features and extension such as:

  • Reflection less IoC processor,

  • Event bus to help beans to communicate between them,

  • HTTP server which is an abstraction of the Apache Tomcat web server,

  • HTTP client based on the java.net.httpClient with an extended configuration,

  • JsonRPC endpoint server,

  • Json support mapper for serialization/deserialization,

  • CLI helper to easily build command line application,

  • Configuration model with environment variables abstraction mapping designed for the cloud,

  • Full Java Record integration,

  • Simple Persistence layer based on common jdbc prepare statement and Record binding,

  • Observability module to publish logs, metrics, healthchecks and tracing,

  • Handlebar templating helper,

  • JUnit5 support for writing tests,

  • GraalVM friendly and easy build

Get started

The magic of Fusion is on the processor part that has the responsibility to build the runtime, so you just need to depend on the fusion-api in compile scope (which is the default with Apache Maven) to be included to the application.

TIP

you can learn more on the Setup page.

<dependency>
    <groupId>io.yupiik.fusion</groupId>
    <artifactId>fusion-api</artifactId>
    <version>${fusion.version}</version>
</dependency>

<dependency>
    <groupId>io.yupiik.fusion</groupId>
    <artifactId>fusion-build-api</artifactId>
    <version>${fusion.version}</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>io.yupiik.fusion</groupId>
    <artifactId>fusion-processor</artifactId>
    <version>${fusion.version}</version>
    <scope>provided</scope>
</dependency>

Note the provided scope which enables to bring automatically the build time generator without having to deliver it at runtime so your deliverable stays light!

That's all!

Example with JsonRPC endpoint

To implement a simple JsonRPC endpoint, you just need to add these dependencies into your pom.xml:

<dependency>
    <groupId>io.yupiik.fusion</groupId>
    <artifactId>fusion-jsonrpc</artifactId>
    <version>${fusion.version}</version>
</dependency>
TIP

the fusion-jsonrpc module depend on the fusion-http-server and the fusion-json, so you can configure and use them without adding them to the dependencies

public class CustomerEndpoint {
    @JsonRpc(value = "createCustomer", documentation = "Creates a new customer")
    public Customer createCustomer(final Request request) {
        // ...
    }

    @JsonRpc(value = "retrieveCustomer", documentation = "Retrieve an existing customer")
    public Customer retrieveCustomer(final Request request) {
        // ...
    }
}

Build the application:

mvn clean install

Then add the Apache Maven exec plugin to test the execution:

<build>
    <plugins>
        <plugin><!-- mvn exec:java -->
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <configuration>
                <mainClass>io.yupiik.fusion.framework.api.main.Launcher</mainClass>
            </configuration>
        </plugin>
...
TIP

we are using the ready to use Fusion launcher but user can create a custom main method to start the application container .

Once executed, you can call your endpoint:

curl \
  http://localhost:8080/jsonrpc \
  -d '{"jsonrpc":"2.0","method":"createCustomer","params":{"firstname":"John", "lastname":"Doe"}}'

Thanks to JSON-RPC, if you have multiple customer to create in one time, you can use the bulk option:

curl \
  http://localhost:8080/jsonrpc \
  -d '[ \
    {"id":1,"jsonrpc":"2.0","method":"createCustomer","params":{"firstname":"John", "lastname":"Doe"}}, \
    {"id":2,"jsonrpc":"2.0","method":"createCustomer","params":{"firstname":"James", "lastname":"Bond"}} \
  ]'

GraalVM friendly

Thanks to Apache Geronimo Arthur project, it's very easy to build your application in native just by adding the maven plugin dependency:

<build>
    <plugins>
        <plugin>
            <!--
                mvn arthur:native-image for binaries
                mvn arthur:native-image arthur:docker for build docker image with binaries
            -->
            <groupId>org.apache.geronimo.arthur</groupId>
            <artifactId>arthur-maven-plugin</artifactId>
            <version>${arthur.version}</version>
            <configuration>
                <graalVersion>22.3.0.r17</graalVersion>
                <main>io.yupiik.fusion.framework.api.main.Launcher</main>
            </configuration>
        </plugin>
...

Then you can build the binary of your application:

mvn arthur:native-image for binaries

Or build a docker image with the binary include:

mvn arthur:native-image arthur:docker

Sorry to disappoint you if you are thinking that it will be hard to build a native app!

Conclusion

This post is the announcement of the new Yupiik Fusion project with a short startup presentation, and we will add new blog posts about another examples to show how to use the full power Fusion.

To learn more, you can check the online documentation and the source code repository .

Enjoy!

From the same author:

In the same category: