public interface ReconnectConfig extends Config
This is use to configure reconnection behavior for a specific connector. If reconnect is enabled, whenever a client connection is lost, messages for the client will continue to be queued. This allows the client to reconnect and pick up from where they left off.
Because messages will still be queued whilst the client is disconnected the configuration also allows a different maximum queue depth to be specified to use in the period of disconnection.
The keep alive and maximum queue depth properties can be changed at any time, even after the server has started.
Modifier and Type | Method and Description |
---|---|
long |
getKeepAlive()
Gets the keep alive value.
|
int |
getMaximumQueueDepth()
Gets the maximum queue depth.
|
int |
getRecoveryBufferSize()
Returns the maximum number of sent messages that can be recovered on
reconnection.
|
void |
setKeepAlive(long keepAlive)
Sets the keep alive value.
|
void |
setMaximumQueueDepth(int maxDepth)
Sets the maximum queue depth value.
|
void |
setRecoveryBufferSize(int size)
Set the maximum number of sent messages that can be recovered on
reconnection.
|
void setKeepAlive(long keepAlive) throws ConfigException
Setting a non-zero value for this property enables the reconnect functionality for all clients connecting via the owning connector.
The value represents a period of time which a client's session is to be retained after a connection is lost. During this period messages will continue to be queued for the client.
By default this value is 300000 ms (5 minutes). Set this value to 0 to disable reconnection.
keepAlive
- the time in milliseconds to keep context for a
disconnected client so that it may reconnect. A value of zero
indicates that reconnect is not possible.ConfigException
- if unable to set propertylong getKeepAlive()
void setMaximumQueueDepth(int maxDepth) throws ConfigException
This determines how large the client queue is allowed to become whilst waiting for the client to re-connect.
This can be set to any value as it will only be used if it is greater than the current maximum queue depth for the client queue.
By default this is set to 0 which means the queue size will not be altered when a client is disconnected.
maxDepth
- maximum queue size or zero if an alternate queue size is
not to be used. Any value less than the configured maximum queue
depth would not be used anyway.ConfigException
- if unable to set propertyint getMaximumQueueDepth()
void setRecoveryBufferSize(int size) throws ConfigException
If the keep alive
time is not zero, this
connector supports reconnection. For each client connected via this
connector, the server will retain a buffer of up to size
sent
messages. If a client disconnects and reconnects, the server uses this
buffer to re-send messages that the client has not received.
The default value is 128 messages. Higher values increase the chance of successful reconnection, but increase the per-client memory footprint.
size
- number of messages; may be 0ConfigException
- if a negative value is provided, or the
configuration is lockedint getRecoveryBufferSize()
Copyright © 2022 Push Technology Ltd. All Rights Reserved.