Implementing services in Java

The Akka Serverless Java SDK offers an idiomatic, annotation-based Java support library for writing stateful services. Before you attempt to write your first service in Java, we recommend that you read about best design practices and understand the development process.


The following are required to start writing services in Java:

Java version

Akka Serverless requires at least Java 8, though we recommend using Java 11, which has better support for running in containers. While it is possible to build a GraalVM native image for Java service implementations, at this stage the SDK offers no specific assistance or configuration to aid in doing that.

Build tool

Akka Serverless does not require any particular build tool, you can select your own.


Since Akka Serverless is based on gRPC, you need a protoc compiler to compile gRPC protobuf descriptors. While this can be done by downloading, installing and running protoc manually, most popular build tools have a protoc plugin which will automatically compile protobuf descriptors during your build.


Akka Serverless runs in Kubernetes using Docker. You will need Docker to build container images that you can deploy to Kubernetes. Most popular build tools have plugins that assist in building Docker images.

Java support library

See the instructions in Install the SDK library.

Install the SDK library

As mentioned, you can use the build tool of your choice. The following examples show how to install the Java library for Gradle, Maven, and sbt.


In your build.gradle file, add the following:

compile group: 'io.cloudstate', name: 'cloudstate-java-support', version: '0.5.2'

In your .pom file, add the following:


In your dependencies file, add the following:

libraryDependencies += "io.cloudstate" % "cloudstate-java-support" % "0.5.2"

What’s next