Spring Cloud’s declarative service call (Feign)

Table of Contents OpenFeign Introduction Common annotations remote call Timeout control Configuration Log enhancement Feign Remote calling method Introduction use 1.Introduce dependencies 2.Add comments 3. Write Feign client 4. Test Implementation principle Custom configuration 1.Log level 2. Response result parser 3. Request parameter encoding 4.Supported annotation formats 5. Failed retry mechanism Feign VS OpenFeign Same […]

[Microservice] Feign integrates Sentinel, and deeply explores Sentinel’s isolation and circuit breaker degradation rules, as well as authorization rules and custom exception return results.

Article directory Preface 1. Feign integrates Sentinel 1.1 Implementation steps 1.2 FallbackFactory example 2. Sentinel implements isolation 2.1 How to implement isolation 2.2 Sentinel implementation of thread isolation example 3. Circuit breaker downgrade rules 3.1 Principle and process of circuit breaker degradation 3.2 Circuit breaker strategy – slow call 3.3 Circuit breaker strategy – abnormal […]

Interpretation of OpenFeign calls in SpringCloud

Table of Contents basic introduction introduction OpenFeign overview OpenFeign role @FeignClient @EnableFeignClients Java code practice Practical architecture Parent project pom file teacher-serviceservice student-serviceservice test Custom configuration Basic introduction Introduction If we use RestTemplate to initiate remote calling code, there will be some problems, such as: ?Poor code readability and inconsistent programming experience ?URLs with complex […]

Exploring the underlying reasons why global transaction Xid fails in the Openfeign cross-node environment in SpringCloudAlibaba Seata

Original/Zhu Jiqian During the process of setting up Spring Cloud Alibaba’s Seata distributed transaction, when calling different services through openfeign across nodes, it was found that the global transaction XID was at the current node, which is the TM. It is normal to obtain the distributed global transaction XID through RootContext.getXID(). , but it is […]

02Nacos, Feign and Gateway configuration

1. Nacos configuration management 1.Unified configuration management Hot update of configuration changes ①Add configuration information in Nacos: ② Fill in the configuration information in the pop-up form: 2.The steps for configuration acquisition are as follows The configuration file bootstrap.yml has a higher priority than application.yml. Put the nacos address into bootstrap.yml. ①Introduce Nacos configuration management […]

Pitfalls encountered by RequestInterceptor in OpenFeign (Incomplete output stream problem)

Reprint Incomplete output stream problem solved 1. Foreword When using OpenFeign, we sometimes need to add the request header in the request received by the api to the request header in the request to the server. In this case, we need to use @Component public class OpenFeignConfig implements RequestInterceptor { @Override public void apply(RequestTemplate template) […]

Practical combat of springcloud openfeign+Nacos

Practical combat of springcloud openfeign + Nacos 1. Introduction to OpenFeign OpenFeign is springcloud’s support for SpringMVC annotations based on Feign, such as @RequestMapping and so on. OpenFeign’s @FeignClient can parse the interface under the @RequestMapping annotation of SpringMVC, and generate implementation classes through dynamic proxy, perform load balancing and call other services in the […]

Sentinel current limiting fuse integrates OpenFeign components

Principle address: Principle explanation address Service circuit breaker and current limiting 1. Circuit breaker downgrade Note: Hystrix and sentinel are currently popular circuit breaker degradation components. The following is a function comparison chart: Service circuit breaker steps: Sentinel’s separate circuit breaker downgrade will not be described in detail. Here is the integrated circuit breaker implementation […]

SpringCould microservice protection and authorization rules 03 – Isolation and degradation (FeignClient integrates Sentinel, thread isolation, circuit breaker degradation, custom exception results, rule persistence, and push mode implementation)

Directory 3. Isolation and downgrade 3.1.FeignClient integrates Sentinel 3.1.1. Modify the configuration and enable the sentinel function 3.1.2. Write failure downgrade logic 3.1.3. Summary 3.2. Thread isolation (bulkhead mode) 3.2.1. How to implement thread isolation 3.2.2. Sentinel thread isolation 1) Configure isolation rules 2) Jmeter test 3.2.3. Summary 3.3. Circuit breaker downgrade 3.3.1. Slow call […]

OpenFeign custom Decoder, parses the global public class to determine status and returns the data attribute

Need arises Use Feign to call the service interface to return a public class. Every time you use it, you need to judge the status and obtain data, which is very redundant. You can use a custom decoder Decoder to uniformly judge the status of the entity class and obtain data when the call returns. […]