Class CircuitBreakerClientWithRetryAsync
java.lang.Object
org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker.clientserver.CircuitBreakerClientWithRetryAsync
- All Implemented Interfaces:
Serializable
@RequestScoped
public class CircuitBreakerClientWithRetryAsync
extends Object
implements Serializable
A client to exercise Circuit Breaker thresholds using Retries.
Analogous to
CircuitBreakerClientWithRetry
but methods are annotated with Asynchronous
- 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
-
CircuitBreakerClientWithRetryAsync
public CircuitBreakerClientWithRetryAsync()
-
-
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) @Asynchronous public Future<Connection> serviceA() -
serviceB
@CircuitBreaker(successThreshold=2, requestVolumeThreshold=4, failureRatio=0.75, delay=50000L) @Retry(retryOn=TestException.class, maxRetries=2) @Asynchronous public Future<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) @Asynchronous public Future<Connection> serviceC()Configured to always time out and Retry until CircuitBreaker is triggered on 4th call. Runs asynchronously. -
serviceWithRetryOnCbOpen
@CircuitBreaker(requestVolumeThreshold=4, failureRatio=0.75, delay=1000L) @Retry(retryOn=org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException.class, maxRetries=20, delay=100L, jitter=0L) @Asynchronous public Future<String> serviceWithRetryOnCbOpen(boolean throwException) Has a CircuitBreaker and Retries on CircuitBreakerOpenException- Parameters:
throwException
- whether this method should throw a test exception 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) @Asynchronous public Future<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) @Asynchronous public Future<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"
-