Package com.yahoo.messagebus.routing
Interface RetryPolicy
- All Known Implementing Classes:
RetryTransientErrorsPolicy
public interface RetryPolicy
When a
Reply
containing errors is returned to a MessageBus
,
an object implementing this interface is consulted on whether or not to resend the corresponding Message
. The policy is passed to the message bus at creation time using the MessageBusParams.setRetryPolicy(RetryPolicy)
method.- Author:
- Simon Thoresen Hult
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canRetry
(int errorCode) double
getRetryDelay
(int retry) Returns the number of seconds to delay resending a message.
-
Method Details
-
canRetry
boolean canRetry(int errorCode) Returns whether or not aReply
containing anError
with the given error code can be retried. This method is invoked once for each error in a reply.- Parameters:
errorCode
- The code to check.- Returns:
- True if the message can be resent.
-
getRetryDelay
double getRetryDelay(int retry) Returns the number of seconds to delay resending a message.- Parameters:
retry
- The retry attempt.- Returns:
- The delay in seconds.
-