Hystrix是如何工作的

下面这幅图相当重要

Hystrix是如何工作的

稍微解释一下上面的流程:

Construct a HystrixCommand or HystrixObservableCommand Object

Execute the Command

Is the Response Cached?

Is the Circuit Open?

Is the Thread Pool/Queue/Semaphore Full?

HystrixObservableCommand.construct() or HystrixCommand.run()

Calculate Circuit Health

Get the Fallback

Return the Successful Response

 

1. 构造一个HystrixCommand或者HystrixObservableCommand对象

第一步是构造一个HystrixCommand或HystrixObservableCommand对象来表示对依赖项的请求。例如:

 

HystrixCommand command = new HystrixCommand(arg1, arg2); HystrixObservableCommand command = new HystrixObservableCommand(arg1, arg2);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zyydyz.html