public class MaintNotificationsConfig extends Object
Maintenance events allow clients to receive push notifications about server-side maintenance operations (moving, failing over, migrating) to enable graceful handling of connection disruptions.
The options provided by this class are used by Lettuce to determine whether to listen for and process maintenance events, and configure requested endpoint type for maintenance notifications.
{
@code
// Enable maintenance events with endpoint type automatically determined based on connection characteristics.
MaintNotificationsConfig options = MaintNotificationsConfig.enabled();
// Enable maintenance events and force endpoint to external IP addresses
MaintNotificationsConfig options = MaintNotificationsConfig.enabled(EndpointType.EXTERNAL_IP);
// Builder pattern
MaintNotificationsConfig options = MaintNotificationsConfig.builder().enableMaintNotifications()
.autoResolveEndpointType().build();
}
| Modifier and Type | Class and Description |
|---|---|
static class |
MaintNotificationsConfig.Builder |
static class |
MaintNotificationsConfig.EndpointType
Endpoint types for maintenance event notifications.
|
static class |
MaintNotificationsConfig.EndpointTypeSource
Strategy interface for determining the endpoint address type to request in maintenance notifications.
|
| Modifier and Type | Field and Description |
|---|---|
static MaintNotificationsConfig.EndpointTypeSource |
DEFAULT_ENDPOINT_TYPE_SOURCE |
static boolean |
DEFAULT_MAINT_NOTIFICATIONS_ENABLED |
| Modifier | Constructor and Description |
|---|---|
protected |
MaintNotificationsConfig(MaintNotificationsConfig.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
static MaintNotificationsConfig.Builder |
builder() |
static MaintNotificationsConfig |
create()
Create a new instance of
MaintNotificationsConfig with default settings. |
static MaintNotificationsConfig |
disabled()
Creates
MaintNotificationsConfig with disabled support for maintenance notifications. |
static MaintNotificationsConfig |
enabled()
Creates
MaintNotificationsConfig with enabled support for maintenance notifications. |
static MaintNotificationsConfig |
enabled(MaintNotificationsConfig.EndpointType endpointType)
Creates maintenance events options with a fixed address type.
|
MaintNotificationsConfig.EndpointTypeSource |
getEndpointTypeSource()
Returns the endpoint type source used to determine the requested endpoint type.
|
boolean |
maintNotificationsEnabled()
Check if maintenance events are supported.
|
public static final boolean DEFAULT_MAINT_NOTIFICATIONS_ENABLED
public static final MaintNotificationsConfig.EndpointTypeSource DEFAULT_ENDPOINT_TYPE_SOURCE
protected MaintNotificationsConfig(MaintNotificationsConfig.Builder builder)
public static MaintNotificationsConfig.Builder builder()
public static MaintNotificationsConfig create()
MaintNotificationsConfig with default settings.MaintNotificationsConfig with default settings.public static MaintNotificationsConfig disabled()
MaintNotificationsConfig with disabled support for maintenance notifications.
Client will not send MAIN_NOTIFICATIONS ON command and will not listen for maintenance notifications.
public static MaintNotificationsConfig enabled()
MaintNotificationsConfig with enabled support for maintenance notifications.
The maintenance notifications endpoint type is automatically determined based on connection characteristics.
public static MaintNotificationsConfig enabled(MaintNotificationsConfig.EndpointType endpointType)
Always requests the specified endpoint type for maintenance notifications.
endpointType - the fixed endpoint type to requestpublic boolean maintNotificationsEnabled()
public MaintNotificationsConfig.EndpointTypeSource getEndpointTypeSource()
The endpoint type source determines what MaintNotificationsConfig.EndpointType to request for maintenance notifications.
null if maintenance events are disabledCopyright © 2025 lettuce.io. All rights reserved.