Interface RetryScheduler
- All Known Implementing Classes:
AsyncRetryScheduler
public interface RetryScheduler
Interface towards a mechanism that decides whether to schedule a message for dispatching when a previous attempts
failed.
- Since:
- 2.0
- Author:
- Allard Buijze
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRetryScheduler.Dispatcher<M extends Message,R extends Message> Represents the logic to dispatch a message and attempt to retrieve the result -
Method Summary
Modifier and TypeMethodDescription<M extends Message,R extends Message>
MessageStream<R> scheduleRetry(M message, ProcessingContext processingContext, Throwable cause, RetryScheduler.Dispatcher<M, R> dispatcher) Schedules the givenmessageto retry dispatching using the givendispatchingfunction.
-
Method Details
-
scheduleRetry
<M extends Message,R extends Message> MessageStream<R> scheduleRetry(@Nonnull M message, @Nullable ProcessingContext processingContext, @Nonnull Throwable cause, @Nonnull RetryScheduler.Dispatcher<M, R> dispatcher) Schedules the givenmessageto retry dispatching using the givendispatchingfunction.Implementations may execute the retries immediately or schedule them later retry. The returned
MessageStreammay complete after several retry attempts or immediately, depending on whether retries are configured or if the cause indicates that a retry could possibly provide a different outcome.If the scheduler determines that a retry can not lead to a different outcome, it must return immediately with a failed
MessageStreamholding the original givencauseas its failure.- Type Parameters:
M- The type of message to (re)dispatchR- The type of message expected as a result of dispatching- Parameters:
message- The Message being dispatchedprocessingContext- The context under which the message is dispatchedcause- The cause of the failure.dispatcher- The function to execute individual retries- Returns:
- a MessageStream representing the result of the last attempt
-