簡體   English   中英

Hystrix后備方法不運行

[英]Hystrix fallback method does not run

我對一個關閉的端點運行調用,但是hystrix沒有執行回退方法,並拋出異常:

java.util.concurrent.ExecutionException: org.springframework.web.client.ResourceAccessException: 
I/O error on GET request for "http://localhost:8080/wallet/customers/100/cards/": Conexão recusada (Connection refused); nested exception is java.net.ConnectException: Conexão recusada (Connection refused)

有人知道是否缺少任何配置?

我的主要

@EnableCircuitBreaker
@SpringBootApplication
public class WalletPaymentApplication {

    public static void main(String[] args) {
        SpringApplication.run(WalletPaymentApplication.class, args);
    }
}

和我的服務:

public PaymentMethodsData setUpPaymentMethods(String customerId) {
    return new PaymentMethodsData(getCardList(customerId));
}

@HystrixCommand(fallbackMethod = "getCardListCircuitBreaker")
public List<SummaryCardData> getCardList(String customerId) {
    return template.getForObject(configureUrl(cardUrl), CardRows.class, customerId).getRows();
}

public List<SummaryCardData> getCardListCircuitBreaker(String customerId){
    return new ArrayList<>();
}

要啟用@HystrixCommand(fallbackMethod = "getCardListCircuitBreaker")您必須從另一個bean調用您的方法。 然后注釋將正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM