创建简单的熔断降级框架
要达到的目标是: 参与降级的方法参数要一样,当HelloAsync执行出错的时候执行HelloFallBackAsync方法。
public class Person
{
[HystrixCommand("HelloFallBackAsync")]
public virtual async Task<string> HelloAsync(string name)
{
Console.WriteLine("hello"+name);
return "ok";
}
public async Task<string> HelloFallBackAsync(string name)
{
Console.WriteLine("执行失败"+name);
return "fail";
}
}