Interface MqttClientAutoReconnect

All Superinterfaces:
MqttClientDisconnectedListener

@DoNotImplement public interface MqttClientAutoReconnect extends MqttClientDisconnectedListener
Automatic reconnect strategy using an exponential backoff with configurable initial and maximum delays.

The initial delay will be doubled for every unsuccessful connect attempt. The actual delay will be capped at the maximum delay. Additionally a random delay of +-25% will be added.

Since:
1.1
  • Field Details

    • DEFAULT_START_DELAY_S

      static final long DEFAULT_START_DELAY_S
      The default initial delay in seconds the client will wait before it tries to reconnect.
      See Also:
    • DEFAULT_MAX_DELAY_S

      static final long DEFAULT_MAX_DELAY_S
      The default maximum delay in seconds the client will wait before it tries to reconnect.
      See Also:
  • Method Details

    • builder

      Creates a builder for an automatic reconnect strategy.
      Returns:
      the created builder for an automatic reconnect strategy.
    • getInitialDelay

      long getInitialDelay(@NotNull @NotNull TimeUnit timeUnit)
      Returns the initial delay the client will wait before it tries to reconnect.

      This delay will be doubled for every unsuccessful connect attempt.

      Parameters:
      timeUnit - the time unit of the returned initial delay.
      Returns:
      the start delay in the given time unit.
    • getMaxDelay

      long getMaxDelay(@NotNull @NotNull TimeUnit timeUnit)
      Returns the maximum delay the client will wait before it tries to reconnect.
      Parameters:
      timeUnit - the time unit of the returned maximum delay.
      Returns:
      the maximum delay in the given time unit.
    • extend

      Creates a builder for extending this automatic reconnect strategy.
      Returns:
      the created builder.