Skip to content

Spring Cloud教程 - Hystrix运行时动态修改配置 #17

@TFdream

Description

@TFdream

Hystrix默认使用Archaius 来实现的动态配置,我们在上节中,使用了代码的方式来实现配置,这节,我们使用Hystrix的动态配置来实现。

超时时间

1、Hystrix配置整体的超时时间

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=1000

2、配置单个超时时间

hystrix.command.HystrixCommandKey.execution.isolation.thread.timeoutInMilliseconds=1000
hystrix.command.HystrixCommandKey.execution.isolation.strategy = SEMAPHORE

其中HystrixCommandKey为@HystrixCommand 注解中的commandKey。

@HystrixCommand(groupKey = "StoreSubmission", commandKey = "StoreSubmission", threadPoolKey = "StoreSubmission")
public String storeSubmission(ReturnType returnType, InputStream is, String id) {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions