At the beginning of contact with Spring cloud, have not heard of the concept of microservices, for service direct communication is a situation, how to make up the micro-service completely ignorant, see the online tutorials are using Ribbong and Fegin to invoke the interface, Then the official website also gives this tutorial to go all the way to the black ....
1, first record the Ribbon and Fegin technology implementation and problems
The ribbon and Fegin in the final analysis are directly called interface, mainly to solve some need to do multiple services at the same time, the Ribbon directly call the interface address, nothing but to do some encapsulation processing, what exception, according to the service name load balancer, and even the matching circuit breaker hystrix, Turbine, and Fegin is similar, is nothing more than the RESTful API package cost ground function, here is also a problem is fegin call remote interface if not used, the project starts will error, this is very pit very pit.
2, concatenation is not very good can consider the way of Message Queuing
There are two major considerations here, one is concatenation is the above ribbon,fegin, there is a way to decouple the microservices through the message component, the previous way through the reliable event mode, the business compensation mode, The TCC mode (Try-confirm-cancel) can be very high precision to ensure the final consistency of the data, the latter way of thinking when the abnormal appearance can not be very good to ensure the consistency of the data, or to do something more, the above 3 mode can also do a second way of thinking
This article is to be continued ....
Spring Cloud Tai Hang Ribbon and Fegin