Interface RetryPolicy.Outcome
- Enclosing interface:
RetryPolicy
public static sealed interface RetryPolicy.Outcome
The outcome of applying a
RetryPolicy to a given message. The outcome can either be
to reschedule or to not reschedule.-
Method Summary
Modifier and TypeMethodDescriptionstatic RetryPolicy.OutcomeFactory method to create an Outcome that requests the retry to not be rescheduled.static RetryPolicy.OutcomerescheduleIn(long interval, TimeUnit timeUnit) Factory method to create an Outcome that requests the retry to be scheduled at the giveninterval(using giventimeUnit).longThe amount of time to wait before rescheduling the message.The unit in which the interval is expressedbooleanIndicates whether this Outcome indicates rescheduling the dispatch of a message.
-
Method Details
-
rescheduleIn
Factory method to create an Outcome that requests the retry to be scheduled at the giveninterval(using giventimeUnit).- Parameters:
interval- The amount of time to wait before rescheduling the messagetimeUnit- The unit of time in which interval is expressed- Returns:
- an Outcome representing a request to reschedule
-
doNotReschedule
Factory method to create an Outcome that requests the retry to not be rescheduled. Any failure will be relayed to the caller.- Returns:
- an Outcome that requests the retry to not be rescheduled
-
shouldReschedule
boolean shouldReschedule()Indicates whether this Outcome indicates rescheduling the dispatch of a message.- Returns:
trueif the message should be rescheduled, otherwisefalse
-
rescheduleInterval
long rescheduleInterval()The amount of time to wait before rescheduling the message. Should be ignored whenshouldReschedule()returnsfalse.- Returns:
- amount of time to wait before rescheduling the message
-
rescheduleIntervalTimeUnit
TimeUnit rescheduleIntervalTimeUnit()The unit in which the interval is expressed- Returns:
- the unit in which the interval is expressed
-