daixinkai / feign.net Goto Github PK
View Code? Open in Web Editor NEWspring cloud feign for .net
License: MIT License
spring cloud feign for .net
License: MIT License
可不可以在不修改源码的情况下集成nacos
SteeltoeServiceDiscovery.cs
public IList<IServiceInstance> GetServiceInstances(string serviceId)
{
return _discoveryClient.GetInstances(serviceId).Select(s => new SteeltoeServiceInstance(s)).ToList<IServiceInstance>();
}
这个函数有个bug
GetInstances返回节点的时候,没有过滤不健康的节点.
所以集群里有机器下线了,feign请求就有概率失败
研究了好久源码,没找到扩展点。
Steeltoe.Common 3.0.0 中已经将 IDiscoveryClient 迁移到 Steeltoe.Discovery 空间下了
降级回调方法里面能获取到异常吗?我看接口里面没有定义。
/// <summary>
/// 一个接口,表示服务降级提供者
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IFallbackFactory</*out*/ T>
{
T GetFallback();
void ReleaseFallback(T fallback);
}
希望大神能出个文档之类的,更方便查阅使用。
我使用了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> Get2()
{
return await this.AngleSharpTestService.GetHtmlAsync();
}
HttpClient = new FeignHttpClient(new FeignDelegatingHandler(serviceDiscoveryHttpClientHandler));
好像还是使用了传统了方式new了client,
这个方式会带来性能问题
core 2.1以后引入了 HttpClientFactory, 并且引入了 HttpClientBuilder, 应该可以替代部分现有提供的pipeline
考虑升级一下版本?
1.4.1版本变动较大,有没有代码和例子?
测试环境和正式环境地址不一样怎么办,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.