Developer Introduction

Developers new to Utilihive will want to become familiar with the Utilihive Flow Developer SDK. This SDK provides the means to write and test flow configurations in a local environment. It includes all of the tools needed to see how a flow would realistically behave on a production server, from processing API endpoints to handling errors.

Lowcode DSL

Flow configurations are implemented in Kotlin using a low-code, domain-specific language (DSL). This allows configurations to be written as a self-documenting data structure. Android developers might already be familiar with this concept, because Gradle files are also written using a DSL.

With Utilihive’s Lowcode DSL, a flow configuration would look like the following example:

flowConfig {
    id = "example-id"
    description = "Example Flow"
    ownerId = OWNER_ID
    exchangePattern = OneWay

    restApi {
        id = "echo-api"
        apiSpecId = resourceKey.toResourceIdentifier()
    }

    writeFiles {
        id = "write-to-file"
        protocol = FileTransferProtocol.FILE
        path = "data/"
    }
}
In Kotlin terms, flowConfig, restApi, and writeFiles are referred to as "builders".

SDK Components

Local Server

The Utilihive SDK includes a standalone test server that runs in the background with temporary data persistence. This server is launched the first time it is needed (such as when a test is run) and will shut down after a certain period of inactivity. Flow configurations can be deployed to the server to test their output, though the server will not persist these flows long-term.

The test server works out of the box without any additional setup. However, server settings can be overridden as needed. For instance, if the server’s default port conflicts with another program on your computer, you can define a custom port in the flow-server’s local files.

Testing Library

It is important that flows are automatically tested while being developed. Thus, the SDK includes a testing library that enables developers to write unit and functional tests for their flows. The testing library is based on JUnit 5 with support for running concurrent tests.

The testing library will automatically start the local server and deploy flows on it. However, flows that are deployed during a test will be removed as soon as the test completes. The testing library also includes other helpful components like a log asserter and a preconfigured HTTP client to make requests to a flow’s endpoints. The responses from these endpoints can be validated with familiar assertion methods like assertThat().

Example Project

The SDK (and DSL) aren’t downloaded and installed directly. Instead, they are included as a Maven dependency in the project where you are developing flows. To help developers get started more quickly, there is an official example project on GitHub that has the necessary dependencies already set up. The example project includes several sample configurations that range from a single REST endpoint to a distributed messaging setup. Each flow configuration also comes with a corresponding test.

If you’d like to get started with the example project immediately, check out the installation guide next. Please note, however, that even though anyone can freely clone the example project, only licensed users will be able to use the SDK dependency.