Working with Akka Serverless

Use of Akka Serverless allows you to focus on what is important to you—​writing your code:

  • Akka Serverless SDKs provide service development APIs that:

    • Have built-in state models.

    • Allow you to code in the language of choice. Code generation tools are available for Java and Javascript.

    • Leverage gRPC for high-performance communication between services with language-neutral serialization.

  • The Akka Serverless environment provides:

    • A deployment platform that includes integrated logging and monitoring.

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

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

      console
      cli

The development process

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

  • Design microservices by identifying components. Components include actions and Entities. Entities are domain objects that will encapsulate your data and business logic. For each Entity, you choose a state model, which determines how Akka Serverless will manage its data.

  • Set up your development project using your favorite IDE or editor. For Java and JavaScript, we offer code generation tools that create the appropriate project structure for a service and generate a starter service.

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

  • Code your user functions as 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.

You might have services that do not need durable state on the client side or on the server side. Services for the Web UI can be written using any framework you like, and you do not need to deploy them on Akka Serverless. On the server side, you can use actions for stateless functions that you can deploy on Akka Serverless.

Akka Serverless provides a scalable, fully-managed cloud environment for your services. The diagram below illustrates an Akka Serverless project. Akka Serverless has scaled the deployed services into clusters to handle demand. The exploded service shows the proxy, which manages communication and persistence and includes your service container image.

An Akka Serverless project

At runtime, communication occurs between clients and the Entities in your service as shown in the illustration below. You generate client interfaces from the gRPC schema, which defines the type of messages the service will accept. The proxy receives the messages and sends them to the service. Entities handle the messages. The proxy persists and retrieves Entity state.

client service components

The following sections introduce other facets of the development process.

Programming language of your choice

Akka Serverless uses gRPC, which is not tied to any programming language, for communication between services. Lightbend maintains and supports SDKs for Java and JavaScript. See Language support SDKs for more information on our support policy.

The Open Source community has developed SDKs for the following languages:

  • Dart

  • Go

  • 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 Akka Serverless is compact and straightforward. See the Java support Javadoc as an example.

Defining schemas

gRPC is a language-agnostic 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. Akka Serverless 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.

Service components

Similar to a microservice, each service is a unit of functionality that can contain actions and Entities. Actions encapsulate logic that does not need to preserve state. Entities do contain state, which Akka Serverless stores for you using the state model you choose.

Typically a service manages a single Entity—​a domain object with data items. Each Entity has an identifying key and Akka Serverless instantiates Entity instances based on the key. 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. While Akka Serverless manages data storage and retrieval, you are responsible for writing the code that encapsulates state and domain logic.

Containers and projects

When you are ready to run your services, you 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 Akka Serverless.

For more information. see Deploying a packaged service.

What’s next

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