1.编写代码
2.配置文件application.properties
| hystrix.command.default.execution.isolation.strategy | THREAD\SEMAPHORE | 通过线程池隔离服务 |
| hystrix.command.default.execution.isolation.thread.tiemoutInMilliseconds | 1000 | 超时时间 |
| hystrix.command.default.circuitBreaker.enabled | true | 是否启用断路器 |
| hystrix.command.default.circuitBreaker.requestVolumeThreshold | 20 | 断路最小请求量 |
| hystrix.command.default.circuitBreaker.errorThreadholdPercentage | 50 | 断路最小错误率 |
| hystrix.command.default.metrics.rollingStats.timeInMIlliseconds | 10000 | 断路最小时间 |
| hystrix.command.default.circuitBreaker.sleepWindowInMilliseconds | 5000 | 断路器打开多久后处于半开状态 |
| hystrix.command.default.requestCache.enabled | true | 是否启用请求缓存 |
| hystrix.command.default.coreSize | 10 | 线程池核心线程数 |
| hystrix.threadpool.default.maxQueueSize | 1 | 核心线程数 |
| hystrix.threadpool.default.queueSizeRejectionThreshold | 5 | 队列动态变化大小 |