Concepts

Infinitic is still in active development. Subscribe here to follow the progress.

In Infinitic terminology, a task is a function that "does something". The actual implementation of a task can be limited to a single call to a database or an API, or can be a complex domain-driven action. Tasks are invoked asynchronously through queues (Pulsar topics).

Infinitic lets you add orchestrator services with "workflow" functions, whose mission is to orchestrate task execution, according to any scenario.

Infinitic follows a workflow as code pattern. It means that you can describe your workflow using Java or Kotlin instead of using JSON or Yaml files for example.

Currently, tasks and workflows can be described in Java or Kotlin only. More programming languages could be supported later. We already have some experimental workers running in node.js.

For example, this code orchestrates the sequential processings of the 3 tasks ImageUtil::download, ImageUtil::resize, ImageUtil::upload that may be executed on different servers:

import io.infinitic.workflows.*;

// tasks signatures
public interface ImageUtil {
    byte[] download(url: String);
    byte[] resize(image: ByteArray, size: Int);
    String upload(image: ByteArray);
}

// workflow description
public class ImageCropping extends WorkflowBase {
    private final ImageUtil imageUtil = newTask(ImageUtil.class);

    String handle(String email, String imageUrl) {
        // 1st task: download image as a binary
        byte[] image = imageUtil.download(imageUrl);
        // 2nd task: resize binary
        byte[] resizedImage = imageUtil.resize(image, size);
        // 3rd task: upload new image and get an url as result
        return imageUtil.upload(resizedImage);
    }
}
import io.infinitic.workflows.*

// tasks signatures
interface ImageUtil {
    fun download(url: String): ByteArray
    fun resize(image: ByteArray, size: Int): ByteArray
    fun upload(image: ByteArray): String
}

// workflow description
class ImageCropping: WorkflowBase() {
    private val imageUtil = newTask<ImageUtil>()

    fun handle(email: String, imageUrl: String) {
        // 1st task: download image as a binary
        val image = imageUtil.download(imageUrl)
        // 2nd task: resize binary
        val resizedImage = imageUtil.resize(image, size)
        // 3rd task: upload new image and get an url as result
        return imageUtil.upload(resizedImage)
    }
}

We can see with this example that Infinitic lets us build distributed applications as if we were building on an infallible single-process system.

Writing workflows with Infinitic brings a lot of benefits:

  • versatility: you can use loops, conditions, data manipulations instructions provided by the programming language, without being limited by the capabilities of a DSL
  • maintainability: your workflows are easy to understand, located defined at one place, and are versioned like any other piece of code
  • observability: everything is closely monitored and exposed on dashboards
  • reliability: workflows are immune to service / worker failures
Edit this page on GitHub Updated at Fri, May 28, 2021