@NoImplement public interface RetryPolicyTemplate
RetryPolicy
instance each time the retry goes into effect, thereby resetting any
state the policy may have (counters, etc.)
A RetryNotifier
may be set in order to take action upon each retry attempt.Modifier and Type | Method and Description |
---|---|
default <T> org.reactivestreams.Publisher<T> |
applyPolicy(org.reactivestreams.Publisher<T> publisher)
Applies the retry policy in a non blocking manner by transforming the given
publisher into one configured to apply
the retry logic. |
default <T> org.reactivestreams.Publisher<T> |
applyPolicy(org.reactivestreams.Publisher<T> publisher,
Predicate<Throwable> shouldRetry,
Consumer<Throwable> onExhausted,
Function<Throwable,Throwable> errorFunction)
Applies the retry policy in a non blocking manner by transforming the given
publisher into one configured to apply
the retry logic. |
RetryPolicy |
createRetryInstance() |
RetryContext |
execute(RetryCallback callback,
Executor workManager)
Applies the retry policy by performing a blocking action.
|
Map<Object,Object> |
getMetaInfo() |
RetryNotifier |
getNotifier() |
void |
setMetaInfo(Map<Object,Object> metaInfo) |
void |
setNotifier(RetryNotifier retryNotifier) |
RetryPolicy createRetryInstance()
RetryNotifier getNotifier()
void setNotifier(RetryNotifier retryNotifier)
RetryContext execute(RetryCallback callback, Executor workManager) throws Exception
callback
- a callback with the logic to be executed on each retryworkManager
- the executor on which the retry operations are to be executedRetryContext
Exception
default <T> org.reactivestreams.Publisher<T> applyPolicy(org.reactivestreams.Publisher<T> publisher)
publisher
into one configured to apply
the retry logic.T
- the generic type of the publisher's contentpublisher
- a publisher with the items which might failPublisher
configured with the retry policy.default <T> org.reactivestreams.Publisher<T> applyPolicy(org.reactivestreams.Publisher<T> publisher, Predicate<Throwable> shouldRetry, Consumer<Throwable> onExhausted, Function<Throwable,Throwable> errorFunction)
publisher
into one configured to apply
the retry logic.T
- the generic type of the publisher's contentpublisher
- a publisher with the items which might failshouldRetry
- a predicate which evaluates each item to know if it should be retried or notonExhausted
- an action to perform when the retry action has been exhaustederrorFunction
- function used to map cause exception to exception emitted by retry policy.Publisher
configured with the retry policy.Copyright © 2018. All rights reserved.