【发布时间】:2019-05-21 04:12:45
【问题描述】:
我有一个 Spring Boot 应用程序,我有一个 @Service,它很重,可以执行 0.5 到 5 秒。如果执行时间超过 1 秒,我希望它停止执行并回退到回退方法。
/// entry point
public String longLatingMethod(Payload payload) {
/// long lasting operation that can take up to 5 seconds
return value;
}
// I want this method to be executed if `longLatingMethod` takes more than 1 second to execute.
public String fallbackMethod(Payload payload) {
return defaultValue;
}
现在我已经用Hystrix 框架实现了它,但是由于Hystrix 已经停产,我想知道还有哪些其他库可以用于此目的?
【问题讨论】:
标签: java spring-boot hystrix