Comments (4)
SteeltoeServiceDiscovery.cs
public IList<IServiceInstance> GetServiceInstances(string serviceId) { return _discoveryClient.GetInstances(serviceId).Select(s => new SteeltoeServiceInstance(s)).ToList<IServiceInstance>(); }
这个函数有个bug
GetInstances返回节点的时候,没有过滤不健康的节点.
所以集群里有机器下线了,feign请求就有概率失败
默认启用了缓存,10分钟失效,是不是缓存未到期?
如果排除缓存的原因的话可以查查Steeltoe的文档,看看相关配置(比如过滤不健康节点)
from feign.net.
SteeltoeServiceDiscovery.cs
public IList<IServiceInstance> GetServiceInstances(string serviceId) { return _discoveryClient.GetInstances(serviceId).Select(s => new SteeltoeServiceInstance(s)).ToList<IServiceInstance>(); }
这个函数有个bug
GetInstances返回节点的时候,没有过滤不健康的节点.
所以集群里有机器下线了,feign请求就有概率失败
试了一下,以consul为例:
"consul": {
"host": "xxxxxxx",
"port": "8500",
"discovery": {
"register": false,
"queryPassing": true
}
}
添加queryPassing=true可以过滤错误节点
from feign.net.
我使用了SteeltoeServiceDiscovery3.0.1
//Steeltoe
services.AddDiscoveryClient(Configuration);
//Feign
services.AddFeignClients().AddSteeltoe();
第一个是可以访问服务,第二个不行,请问还需要配置什么吗?
[HttpGet("Get1")]
public async Task Get1()
{
var client = new HttpClient(_handler, false);
return await client.GetStringAsync("http://agent-service/weatherforecast");
}
[HttpGet("Get")]
public async Task<IEnumerable<WeatherForecast>> Get2()
{
return await this.AngleSharpTestService.GetHtmlAsync();
}
from feign.net.
我使用了SteeltoeServiceDiscovery3.0.1
//Steeltoe services.AddDiscoveryClient(Configuration); //Feign services.AddFeignClients().AddSteeltoe();
第一个是可以访问服务,第二个不行,请问还需要配置什么吗?
[HttpGet("Get1")]
public async Task Get1()
{
var client = new HttpClient(_handler, false);
return await client.GetStringAsync("http://agent-service/weatherforecast");
}[HttpGet("Get")] public async Task<IEnumerable<WeatherForecast>> Get2() { return await this.AngleSharpTestService.GetHtmlAsync(); }
请问报什么错呢?
SteeltoeServiceDiscovery 3.0 版本需要引入 Steeltoe.Discovery.Consul 3.0 或者 Steeltoe.Discovery.Eureka 3.0 才行
from feign.net.
Related Issues (10)
- 补充文档 HOT 2
- url 配置 HOT 1
- httpclient在core 2.1以后推荐用factory 初始化 HOT 2
- IDiscoveryClient 已经迁移 HOT 1
- SteeltoeServiceDiscovery3.0.1 请教一下,还需要什么配置? HOT 5
- 怎么才能适配JsonRpc的请求 HOT 1
- 可不可以在不修改源码的情况下集成nacos HOT 2
- 降级回调方法里面能获取到异常吗?我看接口里面没有定义 HOT 6
- 看不到1.4.1版本的代码 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feign.net.