2016-12-19 2 views
0

나는 다음과 같은 방법을봄 부팅 hystrix 통합

@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"; 
} 

을 가지고, 나는 다음과 같은 예외를

com.netflix.hystrix를 얻을. contrib.javanica.exception.HystrixPropertyException : 명령 속성을 설정하지 못했습니다. 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) com.netflix.hystrix.contrib.javanica.command.GenericCommand에서 . (GenericCommand.java:35) at com.netflix.hystrix.contrib.javanica.command. sun.reflect.NativeMethodAccessorImpl.invoke0 (기본 방법)에서 com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect.methodsAnnotatedWithHystrixCommand (HystrixCommandAspect.java:85) 에서 HystrixCommandFactory.create (HystrixCommandFactory.java:44) sun.reflect.NativeMethodAccessorImpl.invoke (알 수없는 소스)에서org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs에서 java.lang.reflect.Method.invoke (알 소스)에 sun.reflect.DelegatingMethodAccessorImpl.invoke (알 소스) (AbstractAspectJAdvice.java:629) 에서 363,210에서 org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod (AbstractAspectJAdvice.java:618) org.springframework.aop.aspectj.AspectJAroundAdvice.invoke (AspectJAroundAdvice.java:70)에서 org.springframework.aop.framework.ReflectiveMethodInvocation에서 . 진행 (ReflectiveMethodInvocation.java:168) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java : org.springframework.aop.framework.CglibAopProxy $ DynamicAdvisedInterceptor.intercept (CglibAopProxy.java:655) com.masary.topup.HystrixComponentPOC $$ EnhancerBySpringCGLIB $$ 95f9b3dd.getResponse에서 () com.masary에서 에서 179) . sun.reflect.DelegatingMethodAccessorImpl.invoke에서 sun.reflect.NativeMethodAccessorImpl.invoke (알 수없는 소스) 에서 sun.reflect.NativeMethodAccessorImpl.invoke0 (기본 방법) 에서 topup.refactor.LedgerUpdateTestCases.test (LedgerUpdateTestCases.java:50) (알 수없는 소스) at java.lang.reflect.Method.invoke (알 수없는 소스) at org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall (FrameworkMethod.java:50) at org.junit.internal.runners.model .ReflectiveCallable.run (ReflectiveCallable.ja va : 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.SpringJUnit4C lassRunner.runChild (SpringJUnit4ClassRunner.java:252) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild (SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner $ 3.org.junit에서 org.junit.runners.ParentRunner.runChildren (ParentRunner.java:288)에서 org.junit.runners.ParentRunner $의 1.schedule (ParentRunner.java:71) 에서 을 (ParentRunner.java:290)를 실행 .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) org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate (RunAfterTestClassCallbacks.java:70)에서 org.junit.runners.ParentRunner.run (ParentRunner.java:363)에서 (스프링클릿 4 클래스 러너.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 (RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:675) at org (RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:192) 에 의해 발생했습니다. java : lang.IllegalArgumentException : 알 수없는 명령 속성 : hystrix.command.operator.execution.isolation.thread.timeoutInMilliseconds at com.netflix.hystrix.contrib.javanica.conf.HystrixPropertiesMa nager.initializeProperties (HystrixPropertiesManager.java:125) com.netflix.hystrix.contrib.javanica.conf.HystrixPropertiesManager.initializeCommandProperties (HystrixPropertiesManager.java:99) com.netflix.hystrix.contrib.javanica.command.GenericSetterBuilder. 구축 (GenericSetterBuilder.java:86) ... 그러나 47 개

, 나는 내가 주석을 제거하고

hystrix.command.operator.execution를 추가 할 때 제외 행동을 성공적으로 실행할 수 있습니다 .isolation.thread.timeoutInMilliseconds = 30000

내 속성 691,363,210

내가 가진 유일한 구성은 내 메인 클래스에 @EnableHystrix 인 방법에 의해

파일 나는 봄 부팅 1.4.0.RELEASE

어떤 도움을 사용하고십시오?

답변

0

올바른 명령 속성 이름입니까? 대신

@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "30000")

있어야하지 않나요?

https://github.com/Netflix/Hystrix/wiki/Configuration#execution.isolation.thread.timeoutInMilliseconds

는 또한 테스트 중 하나에서 일부 조각은 그 많은, 지금 잘 작동 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

+0

덕분에 도움이 될 수 있습니다 –