public class ExponentialBackoffRetrier extends Object implements FailedMessageRetryHandler, Serializable
Constructor and Description |
---|
ExponentialBackoffRetrier()
No args constructor that uses defaults of 100 ms for first retry, max retries of Long.MAX_VALUE and an exponential backoff of
Math.pow(2,i-1) secs for retry i where i = 2,3,... . |
ExponentialBackoffRetrier(Long initialDelayMillis,
Long baseSeconds,
Long maxRetries)
Creates a new exponential backoff retrier.
|
Modifier and Type | Method and Description |
---|---|
void |
acked(KinesisMessageId messageId)
message with messageId succeeded/acked in the spout.
|
boolean |
failed(KinesisMessageId messageId)
message with messageId failed in the spout.
|
void |
failedMessageEmitted(KinesisMessageId messageId)
message with messageId returned by last call to getNextFailedMessageToRetry was emitted/retried by the spout.
|
KinesisMessageId |
getNextFailedMessageToRetry()
Get the next failed message’s id to retry if any, null otherwise.
|
public ExponentialBackoffRetrier()
No args constructor that uses defaults of 100 ms for first retry, max retries of Long.MAX_VALUE and an exponential backoff of Math.pow(2,i-1)
secs for retry i
where i = 2,3,...
.
public ExponentialBackoffRetrier(Long initialDelayMillis, Long baseSeconds, Long maxRetries)
Creates a new exponential backoff retrier.
initialDelayMillis
- delay in milliseconds for first retrybaseSeconds
- base for exponent function in secondsmaxRetries
- maximum number of retries before the record is discarded/ackedpublic boolean failed(KinesisMessageId messageId)
FailedMessageRetryHandler
message with messageId failed in the spout.
failed
in interface FailedMessageRetryHandler
messageId
- the message idpublic void acked(KinesisMessageId messageId)
FailedMessageRetryHandler
message with messageId succeeded/acked in the spout.
acked
in interface FailedMessageRetryHandler
messageId
- the message idpublic KinesisMessageId getNextFailedMessageToRetry()
FailedMessageRetryHandler
Get the next failed message’s id to retry if any, null otherwise.
getNextFailedMessageToRetry
in interface FailedMessageRetryHandler
public void failedMessageEmitted(KinesisMessageId messageId)
FailedMessageRetryHandler
message with messageId returned by last call to getNextFailedMessageToRetry was emitted/retried by the spout.
failedMessageEmitted
in interface FailedMessageRetryHandler
messageId
- the message idCopyright © 2022 The Apache Software Foundation. All rights reserved.