org.apache.storm.kinesis.spout

## Class ExponentialBackoffRetrier

- java.lang.Object
- - org.apache.storm.kinesis.spout.ExponentialBackoffRetrier

- All Implemented Interfaces:
    Serializable, FailedMessageRetryHandler

      public class ExponentialBackoffRetrier
      extends Object
      implements FailedMessageRetryHandler, Serializable

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ExponentialBackoffRetrier

          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,...`.

    - #### ExponentialBackoffRetrier

          public ExponentialBackoffRetrier(Long initialDelayMillis,
                                           Long baseSeconds,
                                           Long maxRetries)

      Creates a new exponential backoff retrier.

      Parameters:
        `initialDelayMillis` - delay in milliseconds for first retry
        `baseSeconds` - base for exponent function in seconds
        `maxRetries` - maximum number of retries before the record is discarded/acked

  - ### Method Detail

    - #### failed

          public boolean failed(KinesisMessageId messageId)

      Description copied from interface: `FailedMessageRetryHandler`

      message with messageId failed in the spout.

      Specified by:
        `failed` in interface `FailedMessageRetryHandler`
      Parameters:
        `messageId` - the message id
      Returns:
        true if this failed message was scheduled to be retried, false otherwise

    - #### acked

          public void acked(KinesisMessageId messageId)

      Description copied from interface: `FailedMessageRetryHandler`

      message with messageId succeeded/acked in the spout.

      Specified by:
        `acked` in interface `FailedMessageRetryHandler`
      Parameters:
        `messageId` - the message id

    - #### getNextFailedMessageToRetry

          public KinesisMessageId getNextFailedMessageToRetry()

      Description copied from interface: `FailedMessageRetryHandler`

      Get the next failed message’s id to retry if any, null otherwise.

      Specified by:
        `getNextFailedMessageToRetry` in interface `FailedMessageRetryHandler`
      Returns:
        messageId

    - #### failedMessageEmitted

          public void failedMessageEmitted(KinesisMessageId messageId)

      Description copied from interface: `FailedMessageRetryHandler`

      message with messageId returned by last call to getNextFailedMessageToRetry was emitted/retried by the spout.

      Specified by:
        `failedMessageEmitted` in interface `FailedMessageRetryHandler`
      Parameters:
        `messageId` - the message id

Copyright © 2019 The Apache Software Foundation. All rights reserved.