@RequestScoped public class CircuitBreakerClientWithRetry extends Object implements Serializable
Constructor and Description |
---|
CircuitBreakerClientWithRetry() |
Modifier and Type | Method and Description |
---|---|
int |
getCounterForInvokingServiceA() |
int |
getCounterForInvokingServiceB() |
int |
getCounterForInvokingServiceC() |
Connection |
serviceA() |
Connection |
serviceB() |
Connection |
serviceC()
Configured to always time out and Retry until CircuitBreaker is triggered on 4th call.
|
String |
serviceWithRetryFailOnCbOpen(boolean throwException)
Has a CircuitBreaker and Retries on all exceptions except TestException and CircuitBreakerOpenException
|
String |
serviceWithRetryOnCbOpen(boolean throwException)
Has a CircuitBreaker and Retries on CircuitBreakerOpenException
|
String |
serviceWithRetryOnTimeout(boolean throwException)
Has a CircuitBreaker and Retries on TimeoutException
|
public int getCounterForInvokingServiceA()
public int getCounterForInvokingServiceB()
public int getCounterForInvokingServiceC()
@CircuitBreaker(successThreshold=2, requestVolumeThreshold=4, failureRatio=0.75, delay=50000L) @Retry(retryOn=java.lang.RuntimeException.class, maxRetries=7) public Connection serviceA()
@CircuitBreaker(successThreshold=2, requestVolumeThreshold=4, failureRatio=0.75, delay=50000L) @Retry(retryOn=java.lang.RuntimeException.class, maxRetries=2) public Connection serviceB()
@CircuitBreaker(successThreshold=2, requestVolumeThreshold=4, failureRatio=0.75, delay=50000L) @Retry(retryOn={java.lang.RuntimeException.class,org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException.class}, maxRetries=7, maxDuration=20000L) @Timeout(value=100L) public Connection serviceC()
@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)
throwException
- whether this method should throw a TestException to simulate an application failure@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)
The method should never throw a TimeoutException so the retry should have no effect
throwException
- whether this method should throw a TestException to simulate an application failure@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)
throwException
- whether this method should throw a TestException to simulate an application failureCopyright © 2020 Eclipse Foundation. All rights reserved.