I have the following method
@HystrixCommand(commandKey="operator",fallbackMethod="getFakeResponse",commandProperties = {
@HystrixProperty(name = "hystrix.command.operator.execution.isolation.thread.timeoutInMilliseconds", value = "30000")
})
public String getResponse(){
try {
Thread.sleep(6000000l);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
}
return "the real thing";
}
when ever I try to run my unit test code to test it, I get the following exception
com.netflix.hystrix.contrib.javanica.exception.HystrixPropertyException: Failed to set Command properties. groupKey: 'HystrixComponentPOC', commandKey: 'operator', threadPoolKey: '' at com.netflix.hystrix.contrib.javanica.command.GenericSetterBuilder.build(GenericSetterBuilder.java:88) at com.netflix.hystrix.contrib.javanica.command.AbstractHystrixCommand.(AbstractHystrixCommand.java:52) at com.netflix.hystrix.contrib.javanica.command.GenericCommand.(GenericCommand.java:35) at com.netflix.hystrix.contrib.javanica.command.HystrixCommandFactory.create(HystrixCommandFactory.java:44) at com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect.methodsAnnotatedWithHystrixCommand(HystrixCommandAspect.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) at com.masary.topup.HystrixComponentPOC$$EnhancerBySpringCGLIB$$95f9b3dd.getResponse() at com.masary.topup.refactor.LedgerUpdateTestCases.test(LedgerUpdateTestCases.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.IllegalArgumentException: unknown command property: hystrix.command.operator.execution.isolation.thread.timeoutInMilliseconds at com.netflix.hystrix.contrib.javanica.conf.HystrixPropertiesManager.initializeProperties(HystrixPropertiesManager.java:125) at com.netflix.hystrix.contrib.javanica.conf.HystrixPropertiesManager.initializeCommandProperties(HystrixPropertiesManager.java:99) at com.netflix.hystrix.contrib.javanica.command.GenericSetterBuilder.build(GenericSetterBuilder.java:86) ... 47 more
however, I can run it successfully with the excepted behavior when i remove annotation and add
hystrix.command.operator.execution.isolation.thread.timeoutInMilliseconds=30000
to my properties file
by the way the only configuration I have is @EnableHystrix on my main class and I am using spring boot 1.4.0.RELEASE
any help please?
Are you sure this is the correct command property name? Shouldn't it be
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "30000")
instead?
https://github.com/Netflix/Hystrix/wiki/Configuration#execution.isolation.thread.timeoutInMilliseconds
also some snippet from one of their tests that may be helpful https://github.com/Netflix/Hystrix/blob/d838f4d1ba65ce55755ab1c73f74c980f04572bf/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/configuration/command/BasicCommandPropertiesTest.java#L155