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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of retries after the initial recovery attempt.Returns the upper bound for recovery delays, including the initial delay.Returns the delay before the first recovery attempt.intReturns the multiplier applied to the delay after each failed recovery attempt.voidsetMaxRetries(int maxRetries) Sets the number of retries after the initial recovery attempt.voidsetMaxRetryDelay(Duration maxRetryDelay) Sets the maximum recovery delay.voidsetRetryDelay(Duration retryDelay) Sets the initial recovery delay.voidsetRetryDelayMultiplier(int retryDelayMultiplier) Sets the multiplier applied to the delay after each failed recovery attempt.
-
Field Details
-
PREFIX
-
-
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
-1for 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-1for 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 atgetMaxRetryDelay().- Parameters:
retryDelayMultiplier- the integer multiplier, at least one- Throws:
IllegalArgumentException- if the multiplier is less than one
-
getRetryDelay
Returns the delay before the first recovery attempt. Defaults to one second. The effective delay is capped bygetMaxRetryDelay().- Returns:
- the initial recovery delay
-
setRetryDelay
Sets the initial recovery delay. Durations are used at millisecond precision.- Parameters:
retryDelay- a duration whose millisecond value is between one andInteger.MAX_VALUE- Throws:
IllegalArgumentException- if the millisecond value is outside the supported range
-
getMaxRetryDelay
Returns the upper bound for recovery delays, including the initial delay. Defaults to sixty seconds.- Returns:
- the maximum recovery delay
-
setMaxRetryDelay
Sets the maximum recovery delay. Durations are used at millisecond precision.- Parameters:
maxRetryDelay- a duration whose millisecond value is between one andInteger.MAX_VALUE- Throws:
IllegalArgumentException- if the millisecond value is outside the supported range
-