When we are working in a microservice then anything could happen. lets image a scenario where downstream services is consumed by upstream service and due to the limitation in threadpool of downstream service.

Sometimes it is not feasible to increase number of worker thread in thread pool but business must continue without impact. Generally we are getting timeout/socketConnection exception when downstream service is not connected. We have to retry for a certain number of times.

Usually, we should consider Retry operation in certain scenarios.

  1. HTTP call to a REST Endpoint
  2. Sending or retrieving messages from Queue
  3. Remote Procedure call or…

RPC is a way to call remote service in the early days and it helps to create disctributed architecture, ofcourse there are bottleneck in RPC. Here i am just writing how RPC get evolve and how it is modified by giant organization i.e.Google to overcome the limitation that exists in RPC and in current era same is struggling with REST. Since now a days working on microservice so of course we all face issue of performance in terms of latency and interservice communication.

Before going further lets clear what are the challenge to use RPC in microservice archotecture:-

  1. Technology Coupling…

Create List Of Data

List Of Data

List<BookDto> bookList = new ArrayList<>();bookList.add(new BookDto(“Way to success”, 1954, “0395489318”));bookList.add(new BookDto(“The Gandhi”, 1953, “0345339711”));bookList.add(new BookDto(“The Lion King”, 1955, “0618129111”));

Year As Key and Book Name As A Value

Map<Integer, String> mapByKeyAsYearAndValueAsName = bookList.stream().collect(Collectors.toMap(BookDto::getYear, BookDto::getName));System.out.println(“==Map By Key As Year And Value As Name==”);System.out.println(mapByKeyAsYearAndValueAsName);System.out.println(“==Map By Key As Year And Value As Name==”);

Year As Key and Book DTO As A Value

Map<Integer, BookDto> yeasAsKeyDtoAsAValue = bookList.stream().collect(Collectors.toMap(BookDto::getYear, Function.identity()));System.out.println(“=======”);System.out.println(yeasAsKeyDtoAsAValue);System.out.println(“========”);

Create New List Of Data

List<MovieDto> movieList = new ArrayList<>();movieList.add(new MovieDto(“Phool Aur Kaante”, 1990));movieList.add(new MovieDto(“Love…

Spring Security Internal Flow — Part 1

Spring Security Internal Working Flow

FBean Post Processor is used to interact with the newly created bean instance before or/and after their initialization method is invoded by spring container.

We can write our custom business logic before and after initialization of bean.It is applicable for the beans either we define as a programmatic/declarative or annotated.

We can do each spring bean object specific post processing by using custom init or initializing bean afterPropertySet or @PostConstruct method

If multiple spring beans and their objects are looking for common processing logic then instead of writing inside each and every spring bean
class, we can write only for one…

From 1.5 version enhancements ( queue interface ), it is the child interface of Collection.

List (I) Set (I) Queue(I) ( Priority Queue and Blocking Queue)
Blocking Queue ( Priority Blocking Queue and Linked Blocking Queue)

If We want to represent a group of individual objects prior to processing
then we should go for queue e.g.- Before sending an SMS message to all mobile numbers we have to store them in some data structure in which order we added mobile numbers in the same order only message should be delivered.
for this first in the first-out requirement, a queue is the…

This will to understand behaviour parameterization or method reference.

import java.util.Arrays;

import java.util.List;

import java.util.OptionalInt;

import java.util.stream.Collectors;

import java.util.stream.IntStream;

import java.util.stream.Stream;

public class FilteringFoods {

public static void main(String… args) {

//only Veg. list using method reference

List<FoodItem> onlyNonVegList = Dish.stream()




//filter price using lamda expression

System.out.println(“Price less than 400”);

List<FoodItem> dishPriceFilter = Dish.stream()

.takeWhile(f -> f.getPrice() < 400)



//Drop while

System.out.println(“Price greater than 400”);

List<FoodItem> dishPriceFltr = Dish.stream()

.dropWhile(f -> f.getPrice() < 400)




boolean anyMatch = Dish.stream()



Java Developer, Software Engineer, Spring, Spark, MicroService, PostgresSQL

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store