Consumer Services (Ribbon, Feign)

1. Background

In the single application, the code can be directly dependent on, you can call directly from your code: But in the micro-services architecture (distributed architecture), the services are running in their processes, even deployed in different hosts and different . area, we need a technology related to remote calls
have Spring Cloud system used widely in the service call two ways:
(1) the use of Rest template service call, you can annotate Rest template templates Ribbon, it has a load balancing Features.
(2) using Feign declarative service call, just the same way as local calls after the statement, Feign default Ribbon load balancing.
Both approaches can be achieved between service calls, you can choose to use under the circumstances, we were used to achieve the following cases to explain.


Consumer Services (Feign)

Spring Cloud Feign is a set of declarative temple service Netflix Feign call the client to achieve, make writing Web service clients easier. We just need it to complete the binding of the Web service interface by creating an interface to configure and use notes. It has pluggable annotation support, including Feign annotations, JAX-RS annotations. It also supports pluggable encoder and decoder .Spring Cloud Feign also expanded to Spring MVC annotation support, but also incorporates the Ribbon to provide HTTP client load balancing implementation.

Guess you like

Origin www.cnblogs.com/xc-xinxue/p/12543488.html