Consider the below code,
Main class
@SpringBootApplication
@EnableCircuitBreaker
public class Main {
}
RestController
@PostMapping("/...")
@HystricCommand(commandProperties = { @HystrixProperty(name=”execution.isolation.thread.timeoutInMilliSeconds”, value=”${request.timeout.interval}”)})
public Object getData(){
}
When I call this endpoint, I am getting:
HystrixProperty Exception- Failed to set commandProperties. groupKey: MyController, commandKey: getData, threadPool: 'null'.
When I remove -> value=”${request.timeout.interval}”
and hardcode it as -> value=”1000”
, the exception is not shown anymore and execution takes place successfully.
Can't we do the value mapping over here? If not, is it possible to move this property to application.properties or globally handle the property via any configuration file?
I don't want the value field to be hardcoded along with my endpoints as I have 10+ endpoints in my application.
From the @HystrixCommand in your controller, remove the HystrixProperty configured for timeout and provide a commandKey=. Now in your application.properties add,
hystrix.command.HystrixCommandKey.execution.isolation.thread.timeoutInMilliseconds=2000
For more details checkout, https://github.com/Netflix/Hystrix/wiki/Configuration#execution.isolation.thread.timeoutInMilliseconds