官术网_书友最值得收藏!

Understanding Eclipse MicroProfile Fault Tolerance

Fault Tolerance provides a collection of tools that prevent code from failing by making it more resilient. Most of these tools are inspired by development good practices (such as retry or fallback) or well-known development patterns (such as circuit breaker or bulkhead).

Fault Tolerance is based on CDI and, more precisely, on the CDI interceptor implementation. It also relies on the MicroProfile Config specification to allow external configuration for Fault Tolerance policies.

The main idea of the specification is to decouple business logic from Fault Tolerance boilerplate code. To achieve that, the specification defines interceptor-binding annotations to apply Fault Tolerance policies on a method execution or on a class (in that case, all class methods have the same policy).

Policies included in the Fault Tolerance specification are the following:

  • Timeout: This is applied with the @Timeout annotation. It adds a timeout to the current operation.
  • Retry: This is applied with the @Retry annotation. It adds retry behavior and allows its configuration on the current operation.
  • Fallback: This is applied with the @Fallback annotation. It defines the code to execute, should the current operation fail.
  • Bulkhead: This is applied with the @Bulkhead annotation. It isolates failures in the current operation to preserve the execution of other operations.
  • Circuit Breaker: This is applied with the @CircuitBreaker annotation. It provides an automatic fast failing execution to prevent overloading the system.
  • Asynchronous: This is applied with the @Asynchronous annotation. It makes the current operation asynchronous (that is, code will be invoked asynchronously).

Applying one or more of these policies is as easy as adding the required annotations on the method (or the class) for which you'd like to have these policies enabled. So, using Fault Tolerance is rather simple. But this simplicity doesn't prevent flexibility, thanks to all of the configuration parameters available for each policy.

Right now, the following vendors provide an implementation for the Fault Tolerance specification:

  • Red Hat in Thorntail and Quarkus
  • IBM in Open Liberty
  • Payara in Payara Server
  • Apache Safeguard for Hammock and TomEE
  • KumuluzEE for KumuluzEE framework

All of these implementations support Fault Tolerance and hence support the same set of features that are described in the next section.

主站蜘蛛池模板: 横峰县| 册亨县| 搜索| 涞源县| 太谷县| 新河县| 洛川县| 商城县| 巴彦淖尔市| 沈阳市| 澄江县| 赣榆县| 河源市| 白银市| 丰宁| 宜宾县| 仪征市| 桂阳县| 施甸县| 红原县| 贵定县| 玛纳斯县| 绥芬河市| 乐至县| 萨迦县| 沙雅县| 台南县| 石柱| 汾西县| 西林县| 老河口市| 潮州市| 郎溪县| 宜兴市| 涿鹿县| 罗城| 安宁市| 菏泽市| 赤峰市| 晴隆县| 沂源县|