Disable Hystrix Functionality

I integrate Hystrix into the application. This application is ready, and we will test integration using hystrix in the sandbox before we push it to production. My question is, is there a way to enable / disable the hystrix function using some configuration settings?

+7
source share
6 answers

There is no single setting for this. You will need to set some parameters to disable Hystrix.

For configuration options, see https://github.com/Netflix/Hystrix/wiki/Configuration :

hystrix.command.default.execution.isolation.strategy=SEMAPHORE
hystrix.command.default.execution.isolation.semaphore.maxConcurrentRequests=100000 # basically 'unlimited'
hystrix.command.default.execution.timeout.enabled=false 
hystrix.command.default.circuitBreaker.enabled=false
hystrix.command.default.fallback.enabled=false

Please double check the version of Hystrix for available parameters.

+7
source

This is all you need:

# Disable Circuit Breaker (Hystrix)

spring:
  cloud:
    circuit:
      breaker:
        enabled: false

hystrix:
  command:
    default:
      circuitBreaker:
        enabled: false
+4

ahus1, Hystrix. , , HystrixCommand -, - HystrixCommand ( execute()). Callable, , , Hystrix ( ), Callable, HystrixCommand. Hystrix , Hystrix , .

+2

spring Managed, hystrixAspect bean applicationContext.xml

bean id = "hystrixAspect" class= "com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect" /" >

Hystrix .

0

this-

  1. , . Hystrix ( ), result-

    hystrix.command.{group-key}.circuitBreaker.forceClosed=false

  2. Java, @HystrixCommand Hystrix .

Java- # 2-

@Pointcut("@annotation(com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand)")
public void hystrixCommandAnnotationPointcut() {
}

@Around("hystrixCommandAnnotationPointcut()")
public Object methodsAnnotatedWithHystrixCommand(final ProceedingJoinPoint joinPoint) throws Throwable {
Object result = null;
Method method = AopUtils.getMethodFromTarget(joinPoint);
if ((System.getProperty(enable.hystrix).equals("true")) {
    result = joinPoint.proceed();
} else {
    result = method.invoke(joinPoint.getTarget(), joinPoint.getArgs());
}
    return result;
}
0

I came across a situation where I wanted to completely disable Hystrix using a single property (we use IBM uDeploy to manage dynamic properties). We use the javanica library built on the basis of Hystrix

  1. Create the Configuration class that creates the HystrixCommandAspect

@Configuration public class HystrixConfiguration{

@Bean(name = "hystrixCommandAspect")
@Conditional(HystrixEnableCondition.class)
public HystrixCommandAspect hystrixCommandAspect(){ 
      return new HystrixCommandAspect()}
}

2. .

public class HystrixEnableCondition implements Condition{ @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata){ return "YES".equalsIgnoreCase( context.getEnvironment().getProperty("circuitBreaker.enabled")) || "YES".equalsIgnoreCase( System.getProperty("circuitBreaker.enabled")); } }
0

All Articles