Async Method Calls using CompletableFuture in Spring Boot

In my previous post, I discussed on CompletableFuture provided by Java concurrency API in JDK 8 onwards. In this article, I want to discuss on using CompletableFuture in a Spring Boot application. šŸŽÆ ThreadPoolTaskExecutor in Spring Boot Spring offers ThreadPoolTaskExecutor as a Java bean which is an abstraction of ThreadPoolExecutor of Java concurrency API. It has key configuration values which you can configure for your application. corePoolSize: It is the minimum number of workers which Spring will keep alive without getting timed out....

Last Updated April 8, 2022 Ā· 3 min Ā· 593 words Ā· Anshul Gautam

Reactive Programming using CompletableFuture in Java

Java 8 introduced CompletableFuture as part of itā€™s concurrency API. This is very helpful when we want to nest operations around asynchronous computations, using the native Java API only. Prior to introducing CompletableFuture, we had Future which provided asynchronous callbacks. But there were few problems associated with Future. CompletableFuture addresses them well. Letā€™s start with understanding what were the issues with Future, that paved the way for CompletableFuture. šŸŽÆ Drawbacks with Future We cannot manually complete the Future object Lack of proper Exception Handling options available We cannot chain multiple Future objects together In the below example, I am creating a simple Future, and trying to get the result from it....

Last Updated April 7, 2022 Ā· 5 min Ā· 942 words Ā· Anshul Gautam

Docker Refresher

šŸ” Letā€™s start by understanding what is Docker? Docker is a platform for building, running, and shipping applications which run and perform the same way everywhere else; just like the way it is supposed to work on the developerā€™s machine. When a developer is building an application, it is not supposed to run only on his machine. Ultimately we want to move this to different environments; like QA for testing, may be move to Staging environment for some pre-production testing or for user acceptance testing, and then move to production environment where our end users will be using the application....

Last Updated April 5, 2022 Ā· 13 min Ā· 2614 words Ā· Anshul Gautam

Reactive Programming in Spring Boot Application

In one of my previous post on this website, I had discussed about Reactive Programming, and how we can implement that in Java using RxJava. In this post, I will be discussing on building a Reactive Spring Boot Application. The application that I will build is going to be a very simple Restful API, which will have two endpoints. One endpoint will fetch the data synchronously. Another endpoint will fetch the same data asynchronously....

Last Updated March 27, 2022 Ā· 11 min Ā· 2343 words Ā· Anshul Gautam

Reactive Programming using RxJava

šŸŽÆ What is RxJava? The official documentation defines it as: It is a Java VM implementation of Reactive Extensions. Reactive Extensions is a library for composing asynchronous and event-based programs by using observable sequences. In simpler terms, RxJava incorporates Reactive Programming paradigm in Java, and helps you consume data in motion, asynchronously. You donā€™t need to scan through the data in motion(pull based blocking calls), in fact the each data element in the motion will come to you(push based non-blocking calls)....

Last Updated March 25, 2022 Ā· 11 min Ā· 2192 words Ā· Anshul Gautam

Spring Boot Refresher

This article helps to get an overview of Spring Boot. This will also be helpful to refresh your basic concepts on this topic quickly. šŸŽÆ What is Spring Boot? Spring Boot is comprised of two separate words; ā€˜Springā€™ and ā€˜Bootā€™. ā€˜Springā€™ is the Spring Framework. This is the Java Application Framework which helps you write Java Enterprise Applications. ā€˜Bootā€™ is Bootstrap. Spring Boot helps you Bootstrap a Spring Application. Well, the official definition goes something like this: Spring Boot makes it easy to create stand-alone, production-grade Spring based applications that you can ā€œjust runā€....

Last Updated March 8, 2022 Ā· 4 min Ā· 652 words Ā· Anshul Gautam