"Welcome To Ashok IT" "Spring Boot and MicroServices" Topic : MicroServices Communication Date : 28/06/2025 (Session - 76) _____________________________________________________________________________________________________________________________ Problems with RestTemplate ========================== * It is blocking Call nature i.e.,Request Per Thread Model. -> When we made request from one MS to another MS using RestTemplate at that server will trap that request by considering as one thread and this thread will be blocked untill unless API Gives response back to client. * RestTemplate calls always be synchronous communication. * RestTemplate will be deprecated in the future release of Spring and doesn't support the Loadbalancing concept. WebClient ========== * We have another technique for Supporting Microservices communication using "WebClient". * Inorder to support with Webclient we need to add the one more starter to "CustomerMicroService" i.e.,spring-boot-starter- webflux. * As we know that WebClient class will not comes through AutoConfiguration, We need to make that Class as spring bean explictly by using @Bean annotation * WebClient will support both Synchronous & Unsynchronous behaviours. Feign Client / Open Feign: ========================= * It is also one type of Rest Client given by Netflix Organization. * Earlier Netfilx Organization used the Feign client for their Internal projects for communication between microservices. * In the last two years Netflix organization stopped the feign client Development because They moved this Project Netflix open source software Community that why name of Feign client got changed to open Feign. * Spring provided abstraction layer on open Feign under sub project of "Spring-cloud" module. * Spring cloud open Feign is an declartive type of developing Rest Client. * As programmer we just need to develop Feign clients as simple "interfaces" and we no need to worry implementation of this interfaces will be taken care Feign. * we need to add the following starter to work with Feigh client i.e.,openfeign * When working with spring cloud open feign we are using main two anotations 1) @EnableFeignClients >>>>> It will scan & identify all the Feign clients available in our project. 2) @FeignClient("name") >>>>> This annotation is used to represent interface as Feign Client. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++