ar:kalix

Industrial IoT with Java 11

ar:kalix is a set of Java libraries designed to simplify the creation of Arrowhead Framework compliant industrial IoT systems. The libraries provide a platform for modern asynchronous I/O, utilities for seamless message encoding/decoding, robust abstractions for creating and communicating with Arrowhead-compliant systems, as well as a plugin-system that makes it convenient to reuse service integrations.

What does it look like?

In the below code example, a system provides a HTTP-TLS-JSON service with a single endpoint GET /example/greeting:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
12
13
14
15
16
17
var system = new ArSystem.Builder()​
    .identity(identity)​
    .trustStore(trustStore)​
    .build();​
​
system.provide(new HttpService()​
    .name("kalix-example-service")​
    .encodings(JSON)​
    .accessPolicy(token())​
    .basePath("/example")​

    .get("/greeting", (request, response) -> {​
        response.status(OK)
            .body("{\"text\":\"Hello, Arrowhead!\"}");​
        return done();​
     }));

What Am I Looking At?

An Arrowhead system could be thought of as a client or server in a traditional distributed application, with the exception that it must meet certain security and interoperability requirements. Lines 1-4 demonstrate the creation of such a system associated with a key store, representing the system's own certificate chain, as well as a trust store, representing all certificates trusted by the system.

Each system may provide one or more services, which could be thought of as regular distributed APIs, as well as consume the services of other systems. Each service is concretely realized by a network interface, which is a specific transport protocol stack, transport security and encoding, such as HTTP-TLS-JSON or MQTT-TLS-XML. Lines 6-17 show the creation of an HTTP-TLS-JSON service with the single HTTP endpoint GET /example/greeting, as well as assigning that service to the system created on lines 1-4.

Where Do I Get It?

The library is currently available both via the Maven Central Repository and as source code downloadable via GitHub.

Copy the following into the <dependencies> element your project pom.xml file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<dependency>
    <groupId>se.arkalix</groupId>
    <artifactId>kalix-base</artifactId>
    <version>0.4.2</version>
</dependency>
<dependency>
    <groupId>se.arkalix</groupId>
    <artifactId>kalix-core-plugins</artifactId>
    <version>0.4.2</version>
</dependency>
<dependency>
    <groupId>se.arkalix</groupId>
    <artifactId>kalix-processors</artifactId>
    <version>0.4.2</version>
    <scope>provided</scope>
</dependency>

Note that the libraries are only guaranteed to work with Java versions 11 and beyond. Make sure to declare what Java version to use in your pom.xml file. For example, adding the below statement to the <properties> element enables Java 11 if using Maven 3.

 1
<maven.compiler.release>11</maven.compiler.release>

For a complete pom.xml example, please refer to the examples repository.

Copy the following into the dependencies section of your project build.gradle file.

1
2
3
implementation 'se.arkalix:kalix-base:0.4.2'
implementation 'se.arkalix:kalix-core-plugins:0.4.2'
annotationProcessor 'se.arkalix:kalix-processors:0.4.2'

Note that the libraries are only guaranteed to work with Java versions 11 and beyond. Make sure to declare what Java version to use in your build.gradle file, such as:

1
2
sourceCompatibility = 11
targetCompatibility = 11

Where Can I Read More?

You can look at examples in the Example Repository, read the Java documentation, or look at the source code on GitHub.

How Mature Is It?

Arrowhead Framework is an on-going standardization and research effort aimed at enabling the creation of Industry 4.0 industrial automation systems. Even if ar:kalix is in a usable condition, a substantial work remains before the framework has been properly standardized, which means that any implementation of it is bound to be unstable. Work on this library commenced as a response to the need for a suitable set of abstractions while evaluating and developing the framework standard.

If you are interested in contributing to the maturity and further development of ar:kalix, in some way or another, please contact Emanuel Palm, the original author of the library, via [emanuel DOT palm AT arkalix DOT se].