在我们的一种实现中,我们将hystrix用作断路器。 我们面临的问题是后备方法代码被复制,这违反了DRY的原理。除此之外,我们还有其他选择吗?
代码:后备方法如下所示-
public PaymentAuthVerifyResponse verifyChargesPreAuthFallback(String txnId) {
PaymentAuthVerifyResponse response = new PaymentAuthVerifyResponse();
return response;
}
public PaymentAuthVerifyResponse cancelPreAuthFallback(String txnId) {
PaymentAuthVerifyResponse response = new PaymentAuthVerifyResponse();
return response;
}
public PaymentAuthResponse chargePreAuthRequestFallback(PaymentAuthRequest chargeParams) {
PaymentAuthResponse response = new PaymentAuthResponse();
return response;
}