Posts

Showing posts from 2020
Image
Implementing gRPC Using Spring Boot and Gradle Background GRPC (gRPC) is a RPC framework pioneered by google later on made public and open source. GRPC has not been officially supported by Spring Framework, so far there are few community libraries that can work seamlessly with Spring Boot. In this article, I will use the lognet's grpc-spring-boot-starter. Project Structure Ideally, the proto files for gRPC is located in another directory, which will then be accessed by the gradle plugin to auto generate the required files.   Gradle Script The heart of gRPC enablement lies on the grpc boot starter, which includes few other tasks outlined as below. https://github.com/overtakerx/grpcbootdemo/blob/main/build.gradle Few important note: first you have to run gradlew compileJava for the auto generation to generate the files from the proto file, then you will need to rebuild the project for Intellij to recognise the auto-generated files. Full demo: https://github.com/overtakerx/grpcbootdem

Spring Cloud Function as Multi Cloud Framework (Azure Function + AWS Lambda + Gradle)

Image
As the title mentioned, this post is about creating a Gradle Spring Boot project that can deploy to both Azure Functions and AWS Lambda. SpringBootConfiguration Before we get into the multicloud project, a bit exploration on the Spring Boot and Spring Cloud Function. Spring Cloud Function provides a faster way to load the Spring Boot application thereby reducing the notorious cold start time experienced in AWS Lam With Spring Boot @SpringBootApplication and @Bean @SpringBootApplication public class MulticloudApplication { @Bean public Function<String , String> uppercase () { return value -> value.toUpperCase() ; } public static void main (String[] args) { SpringApplication. run (MulticloudApplication. class, args) ; } } AWS Lambda Java Cold Start Duration: 4814.89 ms With Spring Boot @SpringBootConfiguration and Java Function<> @SpringBootConfiguration public class MulticloudApplication implements Function<String , String> { public static voi