Microservices Best Practices - vidyasekaran/current_learning GitHub Wiki

  1. If you have configured hystrix for a method just invoke one endpoint if you have multiple like a) restcall b)db then if anyone fails then fallback will be invoked, this is not good.

  2. Use Feign Client to invoke rest so that you can just write interface and annotate it with @FeigClient so that you need not write rest code. You can use ribbon and hystrix which is achieved thru configuration (u do these in application.yml file)

application.yml

feign.hystrix.enable : false

@Feignclient(name="routing-service"...this is the name the sevice is registered with eureka.

use @GetMapping (path) on feign client as it a client, when this method is invoked like interface.method - the base uri made and @GetMapping or @Postmapping with path is constructed and invoked. response will be converted to return type.

Also you need to write impl for fallback service implementing feign client interface

  1. Spring Boot includes an additional set of tools that can make the application development experience a little more pleasant. The spring-boot-devtools module can be included in any project to provide additional development-time features. To include devtools support, simply add the module dependency to your build:

https://docs.spring.io/spring-boot/docs/1.5.16.RELEASE/reference/html/using-boot-devtools.html