У меня есть 3 команды Hystrix A, B, C. Все команды находятся в одной группе.Как я могу принудительно разомкнуть цепь B и C, если Hystrix автоматически открывает цепь A?
Я написал аспект, который выполняется после аннотированного метода Hystrix для завершения. После выполнения аспект проверки проверяет, открыта ли цепь для конкретногокоманда.Если цепь разомкнута, то как я могу разомкнуть цепь всех команд в группе?
@Pointcut("@annotation(com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand)")
public void pointCut() {
}
@After("pointCut()")
public void afterAdviceForAllMethods(JoinPoint joinPoint) throws Throwable {
if(!isHybridResponseEnabled) {
HystrixCommand hystrixCommand=getHystrixCommand(joinPoint);
forceFullyOpenCircuit(hystrixCommand);
}
}
/**
* This method will get the commandKey from the HystrixCommand. Then Check whether the current
* command is open or not. If its open, it will get the groupKey and open the circuit for whole
* group.
*/
private void forceFullyOpenCircuit(HystrixCommand hystrixCommand){
if(null != hystrixCommand) {
String groupKey = hystrixCommand.groupKey();
String commandKey = hystrixCommand.commandKey();
HystrixCircuitBreaker circuitBreaker = getCircuitBreaker(commandKey);
HystrixCommandGroupKey hystrixCommandGroupKey =
HystrixCommandGroupKey.Factory.asKey(groupKey);
if(null != circuitBreaker&&circuitBreaker.isOpen()
&& !openCircuits.contains(groupKey)) {
/**
* open circuit of each command in the group
*/
}