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:
In this blog, we will be discussing how we can get started with writing cloudstate services with the most used language globally- Java.
Before starting we must know the prerequisites of this:
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
CLoudstate donot has any specific requirement of build tool. You can choose your own build tool.
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.
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:
In your .pom file, add the following:
<dependency> <groupId>io.cloudstate</groupId> <artifactId>cloudstate-java-support</artifactId> <version>0.6.0</version> </dependency>
In your dependencies file, add the following:
libraryDependencies += "io.cloudstate" % "cloudstate-java-support" % "0.6.0"
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! 🙂