
# 参数配置说明
 表1参数配置说明 
| 参数名称    | 是否必选 | 参数类型                    | 取值范围                                                                                                                       | 描述       |
|:---|:---|:---|:---|:---|
| bizPool | 否    | ThreadPoolConfig        | 参考[表2]。                                                                              | 线程池配置。   |
| caches  | 否    | Map of CacheConfig      | key为userdefine1，userdefine2...... 单个维度请参考[表3]。 | 多个缓存配置。  |
| rules   | 否    | Map of ClientProperties | key为userdefine1，userdefine2...... 单个维度请参考[表4]。     | 多个熔断和重试。 |
   
 表2ThreadPoolConfig数据结构说明 
| 参数名称                                  | 是否必选 | 参数类型     | 默认值    | 取值范围                                                     | 描述                                                                                                                                                                                                                                                                                |
|:---|:---|:---|:---|:---|:---|
| prioritized                           | 否    | boolean  | false  | true/false                                               | 线程池队列是否采用优先队列，当消息有优先级时需要设置： - true: 优先队列。  - false：非优先队列。   |
| core-pool-size                        | 否    | Interger | 20     | -                                                        | 线程池核心线程数。                                                                                                                                                                                                                                                                         |
| maximum-pool-size                     | 否    | Interger | 32     | -                                                        | 线程池所能容纳的最大线程数。                                                                                                                                                                                                                                                                    |
| work-queue-size                       | 否    | Interger | 60000L | -                                                        | 线程池任务队列大小。                                                                                                                                                                                                                                                                        |
| keep-alive-time-ms                    | 否    | Long     | 5000   | -                                                        | 非核心线程闲置时的超时时长。                                                                                                                                                                                                                                                                    |
| rejected-execution-handler-class-name | 否    | String   | 无      | java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy | 线程池的拒绝策略。                                                                                                                                                                                                                                                                         |
   
 表3CacheConfig数据结构说明 
| 参数名称                               | 是否必选 | 参数类型      | 取值范围           | 默认值                | 描述                                                                        |
|:---|:---|:---|:---|:---|:---|
| ttl                                | 否    | Long      | -              | 21600              | 缓存时长（单位：秒），默认6小时。                                                         |
| performance-ttl                    | 否    | Long      | -              | 600                | 性能缓存时长（单位：秒），默认10分钟。                                                      |
| type                               | 否    | CacheType | redis/caffeine | nocache            | 缓存类型。                                                                     |
| redis-connection-factory-bean-name | 否    | String    | -              | clientcontrolDcs   | 缓存类型为redis时可通过配置该选项指定。RedisConnectionFactory的bean名称来选择所用数据源，默认使用dcs的默认配置。 |
| maximum-size                       | 否    | Long      | -              | 60000L             | caffeine缓存最大数量，默认60000。                                                   |
| cache-consecutive-exception-times  | 否    | Integer   | -              | 3                  | 缓存连续异常次数，默认3次。                                                            |
| cache-interruption-duration        | 否    | Long      | -              | 60                 | 缓存功能关闭时长，单位（秒），默认60。                                                      |
| custom-cache-manager-bean-name     | 否    | String    | -              | customCacheManager | 当缓存类型为custom时需要指定该值。                                                      |
   
 表4ClientProperties数据结构说明 
| 参数名称       | 是否必选 | 参数类型          | 取值范围                                            | 描述                                                                         |
|:---|:---|:---|:---|:---|
| match      | 否    | String        | -                                               | 正则表达式，用于与requestMapping中的url匹配。                                            |
| module     | 否    | FallbackOrder | RetryFirst/CircuitBreakerFisrt二选一的枚举类。          | RetryFirst重试次数不计入断路器/CircuitBreakerFisrt重试次数也计入断路器（默认CircuitBreakerFisrt）。 |
| time-limit | 否    | TimeLimit     | 参考[表5]。   | 限时配置。                                                                      |
| retry      | 否    | Retry         | 参考[表6]。 | 重试的配置。                                                                     |
| fallback   | 否    | Fallback      | 参考[表7]。  | 断路器配置。                                                                     |
   
 表5TimeLimit数据结构说明 
| 参数名称                  | 是否必选 | 参数类型     | 取值范围       | 默认值  | 描述                    |
|:---|:---|:---|:---|:---|:---|
| enable                | 否    | boolean  | true/false | true | 超时开关。                 |
| timeout-duration      | 否    | Duration | -          | 1000 | 限时时长 （单位：毫秒）默认1000ms。 |
| cancel-running-future | 否    | boolean  | true/false | true | 超时是否结束当前任务，默认true。    |
   
 表6Retry数据结构说明 
| 参数名称                           | 是否必选 | 参数类型                         | 取值范围                   | 默认值           | 描述                                                |
|:---|:---|:---|:---|:---|:---|
| enable                         | 否    | boolean                      | true/false             | true          | 重试开关，默认开启。                                        |
| enable-log                     | 否    | boolean                      | true/false             | true          | 重试日志开关，默认开启。                                      |
| log-correlation-property       | 否    | String                       | -                      | ClientControl | 可取出header或attributes中相应字段值打印到重试日志中。               |
| max-attempts                   | 否    | Long                         | -                      | 3             | 最大重试次数，默认为3次。                                     |
| wait-duration-ms               | 否    | Long                         | -                      | 500           | 重试间隔，单位（毫秒），默认500（ms）。                            |
| policy                         | 否    | String                       | Exponential/Randomized | Randomized    | 重试策略，Exponential指数级/Randomized固定间隔（默认Randomized）。 |
| randomized-wait-factor         | 否    | double                       | 0.0-1.0                | 0.5           | 随机策略随机因子，默认0.5。                                   |
| exponential-backoff-multiplier | 否    | double                       | -                      | 2             | 指数退避算法的乘数，默认2.0。                                  |
| ignore-exceptions              | 否    | Class\<? extends Throwable\> | -                      | -             | 不触发重试的异常，此项配置在超时启用时失效。                            |
| retry-exceptions               | 否    | Class\<? extends Throwable\> | -                      | -             | 指定触发重试的异常。                                        |
   
 表7Fallback数据结构说明 
| 参数名称                                         | 是否必选 | 参数类型                         | 取值范围                   | 默认值          | 描述                                                   |
|:---|:---|:---|:---|:---|:---|
| enable                                       | 否    | boolean                      | true/false             | true         | 熔断开关。                                                |
| enable-log                                   | 否    | boolean                      | true/false             | true         | 熔断状态切换日志开关。                                          |
| slow-call-duration-threshold                 | 否    | Long                         | -                      | 60（单位 s）     | 计入慢调用的时间（单位：秒）。                                      |
| slow-call-rate-threshold                     | 否    | Long                         | -                      | 100          | 慢调用百分比(100为关闭慢调用熔断功能)（慢调用计算窗口和失败的窗口是独立计算的两个窗口）。      |
| failure-rate-threshold                       | 否    | Long                         | 0-100                  | 50           | 滑动窗口内失败百分比，默认50。                                     |
| sliding-window-type                          | 否    | String                       | COUNT_BASED/TIME_BASED | TIME_BASED   | 滑动窗口类型（COUNT_BASED次数/TIME_BASED时间）。                  |
| sliding-window-size                          | 否    | Long                         | -                      | 30           | 滑动窗口大小（次/秒）。                                         |
| minimum-number-of-calls                      | 否    | Long                         | -                      | 100          | 滑动窗口内最小请求数（滑动窗口内满足最小请求数才会触发熔断）。                      |
| wait-duration-in-open-state                  | 否    | Duration                     | -                      | 60000（单位 ms） | 进入半开所需时间（断路器打开以后进入半开状态等待时间）。                         |
| permitted-number-of-calls-in-half-open-state | 否    | Long                         | -                      | 10           | 半开状态允许通过的请求数量（如果失败比例达到设置的百分比，则断路器继续进入打开状态，再次等待进入半开）。 |
| ignore-exceptions                            | 否    | Class\<? extends Throwable\> | -                      | -            | 不触发熔断的异常，此项配置在超时启用时失效。                               |
| record-exceptions                            | 否    | Class\<? extends Throwable\> | -                      | -            | 指定触发熔断的异常类。                                          |
   
