Class CircuitBreakerClientWithRetry
java.lang.Object
org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker.clientserver.CircuitBreakerClientWithRetry
- All Implemented Interfaces:
Serializable
A client to exercise Circuit Breaker thresholds using Retries.
- Author:
- Neil Young, Andrew Rouse
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
int
int
serviceA()
serviceB()
serviceC()
Configured to always time out and Retry until CircuitBreaker is triggered on 4th call.serviceWithRetryFailOnCbOpen
(boolean throwException) Has a CircuitBreaker and Retries on all exceptions except TestException and CircuitBreakerOpenExceptionserviceWithRetryOnCbOpen
(boolean throwException) Has a CircuitBreaker and Retries on CircuitBreakerOpenExceptionserviceWithRetryOnTimeout
(boolean throwException) Has a CircuitBreaker and Retries on TimeoutException
-
Constructor Details
-
CircuitBreakerClientWithRetry
public CircuitBreakerClientWithRetry()
-
-
Method Details
-
getCounterForInvokingServiceA
public int getCounterForInvokingServiceA() -
getCounterForInvokingServiceB
public int getCounterForInvokingServiceB() -
getCounterForInvokingServiceC
public int getCounterForInvokingServiceC() -
serviceA
@CircuitBreaker(successThreshold=2, requestVolumeThreshold=4, failureRatio=0.75, delay=50000L) @Retry(retryOn=TestException.class, maxRetries=7) public Connection serviceA() -
serviceB
@CircuitBreaker(successThreshold=2, requestVolumeThreshold=4, failureRatio=0.75, delay=50000L) @Retry(retryOn=TestException.class, maxRetries=2) public Connection serviceB() -
serviceC
@CircuitBreaker(successThreshold=2, requestVolumeThreshold=4, failureRatio=0.75, delay=50000L) @Retry(retryOn={TestException.class,org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException.class}, maxRetries=7, maxDuration=20000L) @Timeout(100L) public Connection serviceC()Configured to always time out and Retry until CircuitBreaker is triggered on 4th call. -
serviceWithRetryOnCbOpen
@CircuitBreaker(requestVolumeThreshold=4, failureRatio=0.75, delay=1000L) @Retry(retryOn=org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException.class, maxRetries=20, delay=100L, jitter=0L) public String serviceWithRetryOnCbOpen(boolean throwException) Has a CircuitBreaker and Retries on CircuitBreakerOpenException- Parameters:
throwException
- whether this method should throw a TestException to simulate an application failure- Returns:
- string "OK"
-
serviceWithRetryOnTimeout
@CircuitBreaker(requestVolumeThreshold=4, failureRatio=0.75, delay=1000L) @Retry(retryOn=org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException.class, maxRetries=20, delay=200L) public String serviceWithRetryOnTimeout(boolean throwException) Has a CircuitBreaker and Retries on TimeoutExceptionThe method should never throw a TimeoutException so the retry should have no effect
- Parameters:
throwException
- whether this method should throw a TestException to simulate an application failure- Returns:
- string "OK"
-
serviceWithRetryFailOnCbOpen
@CircuitBreaker(requestVolumeThreshold=4, failureRatio=0.75, delay=1000L) @Retry(abortOn={TestException.class,org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException.class}, maxRetries=20, delay=200L) public String serviceWithRetryFailOnCbOpen(boolean throwException) Has a CircuitBreaker and Retries on all exceptions except TestException and CircuitBreakerOpenException- Parameters:
throwException
- whether this method should throw a TestException to simulate an application failure- Returns:
- string "OK"
-