hystrix动态修改参数

Hystrix 从入门到深入——运行时修改动态配置

/**
 * 
 * @author zhangshuo
 *
 */
@Component
public class DynamicConfigSource implements PolledConfigurationSource {
  private static final Logger logger = LoggerFactory.getLogger(DynamicConfigSource.class);

  @Override
  public PollResult poll(boolean initial, Object checkPoint) throws Exception {
    Map<String, Object> complete = new HashMap<String, Object>();

    /**
     * 配置中心配置了对应的key/value。其中commandKey是我指定的具体接口。
     */
    complete.put("hystrix.command.commandKey.circuitBreaker.forceOpen",
        “具体配置,比如来自配置中心”);

    logger.debug("poll:{}", complete);

    return PollResult.createFull(complete);
  }
}

  

原文地址:https://www.cnblogs.com/heroinss/p/11821750.html