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

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

Cloudstate with Java (Part 2): Getting Started with Java. In our last blog, we talked about the various prerequisites needed to implement cloudstate with Java. And ofcourse starting it.

In our last  blog, we talked about the various prerequisites needed to implement cloudstate with Java. In this blog we will look into few more points to keep in mind while implementing cloudstate using Java. So lets go ahead!

The Protobuf files

In our previous blog we read about the Protoc compiler which is required to compile gRPC protobuf descriptors. We also learned that this can also be done by installing build tools which already contain a protoc plugin which will automatically compile protobuf descriptors during your build. Lets see one the plugin for that:  Xolstice Maven Protocol Buffers Plugin 

This plugin basically assumes a location which would be src/main/proto for our protobuf files. It also includes any protobuf files coming from our Java dependencies in the protoc include path. The mere advantage of this is that we do not need to do anything to pull in the Cloudstate protobuf types or any of the Google standard protobuf types. As said they are all automatically available for import.

 For example, if we simply paste our protobuf into the location src/main/proto/ and we can also define the Java package to ensure the package name used by:

option java_package = "com.example";

Now if we run mvn compile, we’ll find the generated protobuf files in the location target/generated-sources/protobuf/java.

Creating a main class

The next important thing to discuss is about the main class in our program. Our main class is important because it will be responsible for

  1. Creating the Cloudstate gRPC server
  2. Registering the entities for it to serve
  3. And ofcourse starting it.

cloudstate java serverless computing serverless

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

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

Cloudstate with Java (Part 1): Getting Started with Java. Cloudstate has proved to be a game changer as it provides stateful serverless computing. We will learn how we can implement this using Java.

Java Online Training | Java Online Course | ITGuru

Our Java Online Training provide you to learn about Java programming and its different features with realty. Our Java Online Course includes live sessions, live projects

Serverless Applications - Pros and Cons to Help Businesses Decide - Prismetric

Businesses need to understand serverless application with major pros and cons of serverless architecture, before deciding about serverless computing.

From Serverless to Stateful Serverless

In this blog, I’ll drive your attention towards Serverless architecture, and, then to Stateful Serverless architecture. We will see the pros and cons of such an architecture, followed by the concept of stateful serverless. Thus the title is, From Serverless to Stateful Serverless. So, let’s start with Serverless.