Working with Cloudstate and Akka Serverless

Use of Cloudstate and Akka Serverless together allows you to focus on what is important to you—​writing your code.

Cloudstate provides:

  • APIs for service development.

  • Runtime state management that ensures responsiveness, resilience, and elasticity.

Akka Serverless provides:

  • A deployment platform that includes integrated logging and monitoring.

  • Two interfaces for working with your services and projects—​the browser-based console and the akkasls command line tool:


The development process

In terms of a typical application lifecycle, the main tasks include:

  • Design event-driven microservices by identifying the domain objects (entities) that will encapsulate your data and business logic and choose the best persistence model for each.

  • Define the schema for your services, including entity data types and the messages that will act on them. Use gRPC to generate the service and client interfaces.

  • Code entities using languages and tools that you already know.

  • Package your services in containers.

  • Deploy your containers using simple browser or command-line tools. Run in production, at scale, immediately, paying only for what you actually use.

  • Iterate.

The following sections provide more details on the development process.

Programming language of your choice

Cloudstate uses gRPC, which is not tied to any programming language, for communication between services. Cloudstate includes connectors to gRPC for a growing number of programming languages. If you don’t see your chosen language just let us know, it may already be in the works!

Currently, Cloudstate supports:

  • Dart

  • Go

  • Java

  • JavaScript

  • Kotlin

To write your business logic, you of course will need to know how to code in your chosen language. However, you will not need to learn a substantially different paradigm for using that language: The API for Cloudstate itself is compact and straightfoward. See the Cloudstate Java support Javadoc as an example.

Defining schemas

gRPC is a language-agnositc open-source framework for communications between services. It is not necessary for you to learn the details of gRPC, or how to write gRPC clients in your language of choice. Cloudstate handles all of that for you. You only need to define services and the schemas for their entities using a gRPC protocol. See Writing gRPC descriptors for more details.

Cloudstate services and entities

Similar to a microservice, each Cloudstate service is a unit of functionality that typically manages a single entity—​a domain object with data items. For example, an entity might represent a device in an IOT application, a customer in a banking application, or a shopping cart in a retail application. The Cloudstate API provides data management for your services and their entities. You are responsible for writing the code that encapsulates state and domain logic.

Following the event-driven pattern, a service consumes and acts on messages relating to its entity. A shopping cart entity might have messages that operate on it such as addItem, removeItem and getCart. At runtime, Cloudstate manages multiple entity instances, each of which has a unique identifier. For more information, see how to Design services and Develop services.

Containers and projects

When you are ready to run your services, you use package them into a container image. How you create the container for your service depends on the language and build system of your development technology. Next, you will publish the container to a registry. To deploy to Akka Serverless, you must provide access to the registry containing your images.

An Akka Serverless project contains one or more containers. An container contains one or more services. Akka Serverless scales the services in a container together.

An container can hold all or some of an application’s services. You have the flexibility to implement and deploy only the services with the most stringent requirements with Akka Serverless.

For more information, see:

Deploy and manage

You can use the Akka Serverless console or the akkasls command line interface (CLI) to deploy your project. Once deployed to the Akka Serverless platform, the system manages the container, scales it, and integrates it with both the necessary state (data) and other services—​whether internal or external to Cloudstate.

For more information see Deploying a packaged service.

What’s next

Try out a sample application or learn more about designing and developing Cloudstate services.