Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/patinousward/spring-cloud-openfeign-lb-plugin
spring cloud openfeign 自定义负载均衡(loadbalance)插件,可细化到接口
https://github.com/patinousward/spring-cloud-openfeign-lb-plugin
customer customize lb loadbalance openfeign springcloud
Last synced: 14 days ago
JSON representation
spring cloud openfeign 自定义负载均衡(loadbalance)插件,可细化到接口
- Host: GitHub
- URL: https://github.com/patinousward/spring-cloud-openfeign-lb-plugin
- Owner: patinousward
- License: mit
- Created: 2021-04-30T06:41:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-06T04:57:02.000Z (over 3 years ago)
- Last Synced: 2024-08-01T18:28:47.559Z (3 months ago)
- Topics: customer, customize, lb, loadbalance, openfeign, springcloud
- Language: Java
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spring-cloud-openfeign-lb-plugin
## 1.QuickStart
- 1.1 自定义负载均衡规则
> 自定义类继承AbstractLBRule,rule方法中填充自己的负载均衡算法即可,可参考HashLBRule这个实现类- 1.2 在feign接口中显示调用url,其值为负载均衡规则的name,example:
```
@FeignClient(value= "xxx",url = HashLBRule.NAME)
public interface MyFeign{
}
```
- 1.3 创建bean即可,example:
```
@Configuration
public class CustomizeBeanConfiguration{
@Bean
public LBRule getLBRule(){
return new HashLBRule(MyFeign.class,"key")
}@Bean
public LBRule getLBRule2(){
return new HashLBRule2(MyFeign2.class,"key")
}xxx
}
```