Customizing the default configuration
The Hystrix library allows you to customize the default configuration by using some properties for command and fallback. The command properties can be set using commandProperties
of the @HystrixCommand
annotation:
@HystrixCommand(commandProperties = { @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "300") }) public Account findAccountById(String id) { return accountService.findAccountById(id); }
We have customized the default timeout to 300 milliseconds. Similar to commandProperties
, we can customize the thread pool properties by using the threadPoolProperties
of @HystrixCommand
:
@HystrixCommand(commandProperties = { @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "300") }, threadPoolProperties = { @HystrixProperty(name = "coreSize", value = "30"), @HystrixProperty(name = "maxQueueSize", value = "101"), @HystrixProperty(name...