Class PostgresNotificationConfiguration.ConnectionRecoveryConfiguration

java.lang.Object
io.micronaut.data.jdbc.notification.postgres.PostgresNotificationConfiguration.ConnectionRecoveryConfiguration
Enclosing class:
PostgresNotificationConfiguration

@Requires(classes=org.postgresql.PGConnection.class) @ConfigurationProperties("connection-recovery") public static final class PostgresNotificationConfiguration.ConnectionRecoveryConfiguration extends Object
Settings for reconnecting failed PostgreSQL notification connections. These settings do not apply to initial startup failures or listener callbacks.
Since:
5.3.0
  • Field Details

  • Constructor Details

    • ConnectionRecoveryConfiguration

      public ConnectionRecoveryConfiguration()
  • Method Details

    • getMaxRetries

      public int getMaxRetries()
      Returns the number of retries after the initial recovery attempt. Defaults to unlimited.
      Returns:
      the maximum number of retries, or -1 for unlimited retries
    • setMaxRetries

      public void setMaxRetries(int maxRetries)
      Sets the number of retries after the initial recovery attempt. Zero allows only that initial attempt. A reconnected session resets the retry count and delay after a successful connection check. If it fails before that check, it counts as a failed recovery attempt.
      Parameters:
      maxRetries - the non-negative maximum number of retries, or -1 for unlimited retries
      Throws:
      IllegalArgumentException - if the value is less than -1
    • getRetryDelayMultiplier

      public int getRetryDelayMultiplier()
      Returns the multiplier applied to the delay after each failed recovery attempt. Defaults to two.
      Returns:
      the retry delay multiplier
    • setRetryDelayMultiplier

      public void setRetryDelayMultiplier(int retryDelayMultiplier)
      Sets the multiplier applied to the delay after each failed recovery attempt. One uses a fixed delay. Delays are capped at getMaxRetryDelay().
      Parameters:
      retryDelayMultiplier - the integer multiplier, at least one
      Throws:
      IllegalArgumentException - if the multiplier is less than one
    • getRetryDelay

      public Duration getRetryDelay()
      Returns the delay before the first recovery attempt. Defaults to one second. The effective delay is capped by getMaxRetryDelay().
      Returns:
      the initial recovery delay
    • setRetryDelay

      public void setRetryDelay(Duration retryDelay)
      Sets the initial recovery delay. Durations are used at millisecond precision.
      Parameters:
      retryDelay - a duration whose millisecond value is between one and Integer.MAX_VALUE
      Throws:
      IllegalArgumentException - if the millisecond value is outside the supported range
    • getMaxRetryDelay

      public Duration getMaxRetryDelay()
      Returns the upper bound for recovery delays, including the initial delay. Defaults to sixty seconds.
      Returns:
      the maximum recovery delay
    • setMaxRetryDelay

      public void setMaxRetryDelay(Duration maxRetryDelay)
      Sets the maximum recovery delay. Durations are used at millisecond precision.
      Parameters:
      maxRetryDelay - a duration whose millisecond value is between one and Integer.MAX_VALUE
      Throws:
      IllegalArgumentException - if the millisecond value is outside the supported range