Cloudstate with Java (Part 1): Getting Started with Java

Reading Time: 2 minutes

In today’s world, serverless computing has evolved a lot. And with this concept of serverless computing, Lightbend has come up with an amazing framework known as Cloudstate. 

Cloudstate is a specification, protocol, and reference implementation for providing distributed state management patterns suitable for Serverless computing.

cloudstate.io

To know more about Cloudstate please go through the blog series: Cloudstate – What is it ?

Cloudstate has proved to be a game changer as it provides stateful serverless computing. It has bought powerful new distributed and durable state management primitives based on Akka to the Serverless world. 

This framework can be implemented using numerous languages. Cloudstate basically provides supported library for each of the language. Following are the list of languages it supports:

  • Java
  • Dart
  • Go
  • Javascript
  • Kotlin
  • Python
  • Springboot
  • .Net. 

In this blog, we will be discussing how we can get started with writing cloudstate services with the most used language globally- Java.

Prerequisites

Before starting we must know the prerequisites of this:

Java version

At the least Cloudstate supports Java  8, so you will be needing a minimum of Java 8 on your system. Although it is recommended to use Java 11. It is because Java 11 has better ability to run in containers

Build Tool

CLoudstate donot has any specific requirement of build tool. You can choose your own build tool.

Protoc

For cloudstate, protoc compiler is needed because as it based on gRPC, we need this to compile gRPC protobuf descriptors. This can als be done by installing build tools which already contain a protoc plugin which will automatically compile protobuf descriptors during your build.

Docker

Cloudstate is run on Kubernetes. We need Docker because that is where we can build a container and deploy it to Kubernetes. Most build tools provides us with a plugin that would build docker images for you.

Cloudstate Java support library

To install cloudstate Java support library, we need to include the following in our project:

  1. Maven

In your .pom file, add the following:

<dependency>
 <groupId>io.cloudstate</groupId>
 <artifactId>cloudstate-java-support</artifactId>
 <version>0.6.0</version>
</dependency>
  1. SBT

In your dependencies file, add the following:

libraryDependencies += "io.cloudstate" % "cloudstate-java-support" % "0.6.0"
  1. Gradle

In your build.gradle file, add the following:

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

That’s all for this blog. Stay tuned for more blogs on Implementation of Cloudstate using Java! 🙂

Knoldus-blog-footer-image

Written by 

Anjali Sharma is a passionate and detail-oriented software consultant with more than 1.5 years of experience. She thrives in a fast-paced and creative environment. She is recognized for exhibiting a positive attitude and high energy. She is a good team player and believes in taking ownership of her work. Her hobbies include dancing and reading books. She always focuses on delivering quality work and practicing good coding standards.