Class WanBatchPublisherConfig
- All Implemented Interfaces:
DataSerializable
,IdentifiedDataSerializable
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final WanAcknowledgeType
static final int
static final int
static final String
static final int
static final long
static final long
static final WanPublisherState
static final int
static final int
static final int
static final WanQueueFullBehavior
static final int
static final boolean
static final String
static final boolean
Fields inherited from class com.hazelcast.config.AbstractWanPublisherConfig
className, implementation, properties, publisherId
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the strategy for when the target cluster should acknowledge that a WAN event batch has been processed.Returns theAwsConfig
used by the discovery mechanism for this WAN publisher.Returns theAzureConfig
used by the discovery mechanism for this WAN publisher.int
Returns the maximum amount of time in milliseconds to wait before sending a batch of events to target cluster, ifgetBatchSize()
of events have not arrived within this duration.int
Returns the maximum batch size that can be sent to target cluster.int
Returns type identifier for this class.Returns the cluster name used as a publisher cluster name for authentication on the target endpoint.Returns the currently definedDiscoveryConfig
used by the discovery mechanism for this WAN publisher.int
Returns the period in seconds in which WAN tries to discover new target endpoints and reestablish connections to failed endpoints.Returns the WAN endpoint configuration qualifier.Returns theEurekaConfig
used by the discovery mechanism for this WAN publisher.int
Returns DataSerializableFactory factory ID for this class.Returns theGcpConfig
used by the discovery mechanism for this WAN publisher.long
Returns the maximum duration in nanoseconds that the WAN replication thread will be parked if there are no events to replicate.long
Returns the minimum duration in nanoseconds that the WAN replication thread will be parked if there are no events to replicate.Returns the implementation ofWanPublisher
.Returns the initial WAN publisher state.Returns theKubernetesConfig
used by the discovery mechanism for this WAN publisher.int
Returns the maximum number of WAN event batches being sent to the target cluster concurrently.int
Returns the maximum number of endpoints that WAN will connect to when using a discovery mechanism to define endpoints.int
Returns the capacity of the primary and backup queue for WAN replication events.Returns the configured behaviour of this WAN publisher when the WAN queue is full.int
Returns the duration in milliseconds for the wait time before retrying to send the events to target cluster again in case the acknowledgement has not arrived.Returns the config for the WAN sync mechanism.Returns the comma separated list of target cluster members, e.g.boolean
Returnstrue
if key-based coalescing is configured for this WAN publisher.boolean
Returns whether the WAN connection manager should connect to the endpoint on the private address returned by the discovery SPI.void
Reads fields from the input streamsetAcknowledgeType
(WanAcknowledgeType acknowledgeType) Sets the strategy for when the target cluster should acknowledge that a WAN event batch has been processed.setAwsConfig
(AwsConfig awsConfig) Sets theAwsConfig
used by the discovery mechanism for this WAN publisher.setAzureConfig
(AzureConfig azureConfig) Sets theAzureConfig
used by the discovery mechanism for this WAN publisher.setBatchMaxDelayMillis
(int batchMaxDelayMillis) Sets the maximum amount of time in milliseconds to wait before sending a batch of events to target cluster, ifgetBatchSize()
of events have not arrived within this duration.setBatchSize
(int batchSize) Sets the maximum batch size that can be sent to target cluster.setClassName
(String className) Sets the name of the class implementingWanPublisher
.setClusterName
(String clusterName) Sets the cluster name used as an endpoint group password for authentication on the target endpoint.setDiscoveryConfig
(DiscoveryConfig discoveryConfig) Sets theDiscoveryConfig
used by the discovery mechanism for this WAN publisher.setDiscoveryPeriodSeconds
(int discoveryPeriodSeconds) Sets the period in seconds in which WAN tries to discover new target endpoints and reestablish connections to failed endpoints.setEndpoint
(String endpoint) Sets the WAN endpoint configuration qualifier.setEurekaConfig
(EurekaConfig eurekaConfig) Sets theEurekaConfig
used by the discovery mechanism for this WAN publisher.setGcpConfig
(GcpConfig gcpConfig) Sets theGcpConfig
used by the discovery mechanism for this WAN publisher.setIdleMaxParkNs
(long idleMaxParkNs) Sets the maximum duration in nanoseconds that the WAN replication thread will be parked if there are no events to replicate.setIdleMinParkNs
(long idleMinParkNs) Sets the minimum duration in nanoseconds that the WAN replication thread will be parked if there are no events to replicate.setImplementation
(WanPublisher implementation) No-op method as the implementation cannot be changed for this publisher.setInitialPublisherState
(WanPublisherState initialPublisherState) Sets the initial publisher state.setKubernetesConfig
(KubernetesConfig kubernetesConfig) Sets theKubernetesConfig
used by the discovery mechanism for this WAN publisher.setMaxConcurrentInvocations
(int maxConcurrentInvocations) Sets the maximum number of WAN event batches being sent to the target cluster concurrently.setMaxTargetEndpoints
(int maxTargetEndpoints) Sets the maximum number of endpoints that WAN will connect to when using a discovery mechanism to define endpoints.setProperties
(Map<String, Comparable> properties) Sets the WAN publisher properties.setPublisherId
(String publisherId) Sets the publisher ID used for identifying the publisher in aWanReplicationConfig
.setQueueCapacity
(int queueCapacity) Sets the capacity of the primary and backup queue for WAN replication events.setQueueFullBehavior
(WanQueueFullBehavior queueFullBehavior) Sets the configured behaviour of this WAN publisher when the WAN queue is full.setResponseTimeoutMillis
(int responseTimeoutMillis) Sets the duration in milliseconds for the waiting time before retrying to send the events to target cluster again in case of acknowledgement is not arrived.setSnapshotEnabled
(boolean snapshotEnabled) Sets if key-based coalescing is configured for this WAN publisher.setSyncConfig
(WanSyncConfig syncConfig) Sets the config for the WAN sync mechanism.setTargetEndpoints
(String targetEndpoints) Sets the comma separated list of target cluster members, e.g.setUseEndpointPrivateAddress
(boolean useEndpointPrivateAddress) Sets whether the WAN connection manager should connect to the endpoint on the private address returned by the discovery SPI.toString()
void
Writes object fields to output streamMethods inherited from class com.hazelcast.config.AbstractWanPublisherConfig
equals, getClassName, getProperties, getPublisherId, hashCode
-
Field Details
-
DEFAULT_CLUSTER_NAME
- See Also:
-
DEFAULT_SNAPSHOT_ENABLED
public static final boolean DEFAULT_SNAPSHOT_ENABLED- See Also:
-
DEFAULT_INITIAL_PUBLISHER_STATE
-
DEFAULT_QUEUE_CAPACITY
public static final int DEFAULT_QUEUE_CAPACITY- See Also:
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE- See Also:
-
DEFAULT_BATCH_MAX_DELAY_MILLIS
public static final int DEFAULT_BATCH_MAX_DELAY_MILLIS- See Also:
-
DEFAULT_RESPONSE_TIMEOUT_MILLIS
public static final int DEFAULT_RESPONSE_TIMEOUT_MILLIS- See Also:
-
DEFAULT_QUEUE_FULL_BEHAVIOUR
-
DEFAULT_ACKNOWLEDGE_TYPE
-
DEFAULT_DISCOVERY_PERIOD_SECONDS
public static final int DEFAULT_DISCOVERY_PERIOD_SECONDS- See Also:
-
DEFAULT_MAX_TARGET_ENDPOINTS
public static final int DEFAULT_MAX_TARGET_ENDPOINTS- See Also:
-
DEFAULT_MAX_CONCURRENT_INVOCATIONS
public static final int DEFAULT_MAX_CONCURRENT_INVOCATIONS- See Also:
-
DEFAULT_USE_ENDPOINT_PRIVATE_ADDRESS
public static final boolean DEFAULT_USE_ENDPOINT_PRIVATE_ADDRESS- See Also:
-
DEFAULT_IDLE_MIN_PARK_NS
public static final long DEFAULT_IDLE_MIN_PARK_NS -
DEFAULT_IDLE_MAX_PARK_NS
public static final long DEFAULT_IDLE_MAX_PARK_NS -
DEFAULT_TARGET_ENDPOINTS
- See Also:
-
-
Constructor Details
-
WanBatchPublisherConfig
public WanBatchPublisherConfig()
-
-
Method Details
-
setClassName
Description copied from class:AbstractWanPublisherConfig
Sets the name of the class implementingWanPublisher
. To configure the built-in WanBatchReplication, please useWanBatchPublisherConfig
config class.- Overrides:
setClassName
in classAbstractWanPublisherConfig
- Parameters:
className
- the name of the class implementation for the WAN replication- Returns:
- this config
-
getImplementation
Description copied from class:AbstractWanPublisherConfig
Returns the implementation ofWanPublisher
.- Overrides:
getImplementation
in classAbstractWanPublisherConfig
-
setPublisherId
Description copied from class:AbstractWanPublisherConfig
Sets the publisher ID used for identifying the publisher in aWanReplicationConfig
.- Overrides:
setPublisherId
in classAbstractWanPublisherConfig
- Parameters:
publisherId
- the WAN publisher ID- Returns:
- this config
-
setProperties
Description copied from class:AbstractWanPublisherConfig
Sets the WAN publisher properties.- Overrides:
setProperties
in classAbstractWanPublisherConfig
- Parameters:
properties
- WAN publisher properties- Returns:
- this config
-
setImplementation
No-op method as the implementation cannot be changed for this publisher.- Overrides:
setImplementation
in classAbstractWanPublisherConfig
- Parameters:
implementation
- the implementation for the WAN replication- Returns:
- this config
-
getClusterName
Returns the cluster name used as a publisher cluster name for authentication on the target endpoint. If there is no separate publisher ID property defined, this cluster name will also be used as a WAN publisher ID. This ID is then used for identifying the publisher in aWanReplicationConfig
.- Returns:
- the WAN endpoint cluster name
- See Also:
-
setClusterName
Sets the cluster name used as an endpoint group password for authentication on the target endpoint. If there is no separate publisher ID property defined, this cluster name will also be used as a WAN publisher ID. This ID is then used for identifying the publisher in aWanReplicationConfig
.- Parameters:
clusterName
- the WAN endpoint cluster name- Returns:
- this config
- See Also:
-
isSnapshotEnabled
public boolean isSnapshotEnabled()Returnstrue
if key-based coalescing is configured for this WAN publisher. When enabled, only the latestWanEvent
of a key is sent to target.- See Also:
-
setSnapshotEnabled
Sets if key-based coalescing is configured for this WAN publisher. When enabled, only the latestWanEvent
of a key is sent to target.- Returns:
- this config
- See Also:
-
getBatchSize
public int getBatchSize()Returns the maximum batch size that can be sent to target cluster.- Returns:
- the maximum size of a WAN event batch
-
setBatchSize
Sets the maximum batch size that can be sent to target cluster.- Parameters:
batchSize
- the maximum size of a WAN event batch- Returns:
- this config
-
getBatchMaxDelayMillis
public int getBatchMaxDelayMillis()Returns the maximum amount of time in milliseconds to wait before sending a batch of events to target cluster, ifgetBatchSize()
of events have not arrived within this duration.- Returns:
- maximum amount of time to wait before sending a batch of events
-
setBatchMaxDelayMillis
Sets the maximum amount of time in milliseconds to wait before sending a batch of events to target cluster, ifgetBatchSize()
of events have not arrived within this duration.- Parameters:
batchMaxDelayMillis
- maximum amount of time to wait before sending a batch of events- Returns:
- this config
-
getResponseTimeoutMillis
public int getResponseTimeoutMillis()Returns the duration in milliseconds for the wait time before retrying to send the events to target cluster again in case the acknowledgement has not arrived.- Returns:
- timeout for response from target cluster
-
setResponseTimeoutMillis
Sets the duration in milliseconds for the waiting time before retrying to send the events to target cluster again in case of acknowledgement is not arrived.- Parameters:
responseTimeoutMillis
- timeout for response from target cluster- Returns:
- this config
-
getAcknowledgeType
Returns the strategy for when the target cluster should acknowledge that a WAN event batch has been processed.- Returns:
- acknowledge type
-
setAcknowledgeType
Sets the strategy for when the target cluster should acknowledge that a WAN event batch has been processed.- Parameters:
acknowledgeType
- acknowledge type- Returns:
- this config
-
getTargetEndpoints
Returns the comma separated list of target cluster members, e.g.127.0.0.1:5701, 127.0.0.1:5702
. If you don't know the addresses of the target cluster members upfront, you may consider using some of the discovery strategies.- Returns:
- comma separated list
- See Also:
-
setTargetEndpoints
Sets the comma separated list of target cluster members, e.g.127.0.0.1:5701, 127.0.0.1:5702
. If you don't know the addresses of the target cluster members upfront, you may consider using some of the discovery strategies.- Parameters:
targetEndpoints
- comma separated list- Returns:
- this config
- See Also:
-
getSyncConfig
Returns the config for the WAN sync mechanism. -
setSyncConfig
Sets the config for the WAN sync mechanism.- Parameters:
syncConfig
- the WAN sync config- Returns:
- this config
-
getQueueCapacity
public int getQueueCapacity()Returns the capacity of the primary and backup queue for WAN replication events.One hazelcast instance can have up to
2*queueCapacity
events since we keep up toqueueCapacity
primary events (events with keys for which the instance is the owner) andqueueCapacity
backup events (events with keys for which the instance is the backup). Events for IMap and ICache count against this limit collectively.When the queue capacity is reached, backup events are dropped while normal replication events behave as determined by the
getQueueFullBehavior()
.- Returns:
- the queue capacity
-
setQueueCapacity
Sets the capacity of the primary and backup queue for WAN replication events.One hazelcast instance can have up to
2*queueCapacity
events since we keep up toqueueCapacity
primary events (events with keys for which the instance is the owner) andqueueCapacity
backup events (events with keys for which the instance is the backup). Events for IMap and ICache count against this limit collectively.When the queue capacity is reached, backup events are dropped while normal replication events behave as determined by the
getQueueFullBehavior()
.- Parameters:
queueCapacity
- the queue capacity- Returns:
- this config
-
getQueueFullBehavior
Returns the configured behaviour of this WAN publisher when the WAN queue is full. -
setQueueFullBehavior
public WanBatchPublisherConfig setQueueFullBehavior(@Nonnull WanQueueFullBehavior queueFullBehavior) Sets the configured behaviour of this WAN publisher when the WAN queue is full.- Parameters:
queueFullBehavior
- the behaviour of this publisher when the WAN queue is full- Returns:
- this config
-
getInitialPublisherState
Returns the initial WAN publisher state. -
setInitialPublisherState
public WanBatchPublisherConfig setInitialPublisherState(@Nonnull WanPublisherState initialPublisherState) Sets the initial publisher state.- Parameters:
initialPublisherState
- the state- Returns:
- this configuration
-
getDiscoveryPeriodSeconds
public int getDiscoveryPeriodSeconds()Returns the period in seconds in which WAN tries to discover new target endpoints and reestablish connections to failed endpoints.- Returns:
- period for retrying connections to target endpoints
-
setDiscoveryPeriodSeconds
Sets the period in seconds in which WAN tries to discover new target endpoints and reestablish connections to failed endpoints.- Parameters:
discoveryPeriodSeconds
- period for retrying connections to target endpoints- Returns:
- this config
-
getMaxTargetEndpoints
public int getMaxTargetEndpoints()Returns the maximum number of endpoints that WAN will connect to when using a discovery mechanism to define endpoints. This property has no effect when static endpoint addresses are defined usingsetTargetEndpoints(String)
.- Returns:
- maximum number of endpoints that WAN will connect to
-
setMaxTargetEndpoints
Sets the maximum number of endpoints that WAN will connect to when using a discovery mechanism to define endpoints. This property has no effect when static endpoint addresses are defined usingsetTargetEndpoints(String)
.- Parameters:
maxTargetEndpoints
- maximum number of endpoints that WAN will connect to- Returns:
- this config
-
getMaxConcurrentInvocations
public int getMaxConcurrentInvocations()Returns the maximum number of WAN event batches being sent to the target cluster concurrently.Setting this property to anything less than
2
will only allow a single batch of events to be sent to each target endpoint and will maintain causality of events for a single partition.Setting this property to
2
or higher will allow multiple batches of WAN events to be sent to each target endpoint. Since this allows reordering or batches due to network conditions, causality and ordering of events for a single partition is lost and batches for a single partition are now sent randomly to any available target endpoint. This, however, does present faster WAN replication for certain scenarios such as replicating immutable, independent map entries which are only added once and where ordering of when these entries are added is not necessary. Keep in mind that if you set this property to a value which is less than the target endpoint count, you will lose performance as not all target endpoints will be used at any point in time to process WAN event batches. So, for instance, if you have a target cluster with 3 members (target endpoints) and you want to use this property, it makes sense to set it to a value higher than3
. Otherwise, you can simply disable it by setting it to less than2
in which case WAN will use the default replication strategy and adapt to the target endpoint count while maintaining causality.- Returns:
- the maximum number of WAN event batches being sent to the target cluster concurrently
-
setMaxConcurrentInvocations
Sets the maximum number of WAN event batches being sent to the target cluster concurrently.Setting this property to anything less than
2
will only allow a single batch of events to be sent to each target endpoint and will maintain causality of events for a single partition.Setting this property to
2
or higher will allow multiple batches of WAN events to be sent to each target endpoint. Since this allows reordering or batches due to network conditions, causality and ordering of events for a single partition is lost and batches for a single partition are now sent randomly to any available target endpoint. This, however, does present faster WAN replication for certain scenarios such as replicating immutable, independent map entries which are only added once and where ordering of when these entries are added is not necessary. Keep in mind that if you set this property to a value which is less than the target endpoint count, you will lose performance as not all target endpoints will be used at any point in time to process WAN event batches. So, for instance, if you have a target cluster with 3 members (target endpoints) and you want to use this property, it makes sense to set it to a value higher than3
. Otherwise, you can simply disable it by setting it to less than2
in which case WAN will use the default replication strategy and adapt to the target endpoint count while maintaining causality.- Parameters:
maxConcurrentInvocations
- the maximum number of WAN event batches being sent to the target cluster concurrently- Returns:
- this config
-
isUseEndpointPrivateAddress
public boolean isUseEndpointPrivateAddress()Returns whether the WAN connection manager should connect to the endpoint on the private address returned by the discovery SPI. By default, this property isfalse
which means the WAN connection manager will always use the public address.- Returns:
true
if the WAN connection manager should connect to the endpoint on the private address returned by the discovery SPI- See Also:
-
setUseEndpointPrivateAddress
Sets whether the WAN connection manager should connect to the endpoint on the private address returned by the discovery SPI. By default, this property isfalse
which means the WAN connection manager will always use the public address.- Returns:
- this config
- See Also:
-
getIdleMinParkNs
public long getIdleMinParkNs()Returns the minimum duration in nanoseconds that the WAN replication thread will be parked if there are no events to replicate.- Returns:
- minimum duration in nanoseconds that the WAN replication thread will be parked
-
setIdleMinParkNs
Sets the minimum duration in nanoseconds that the WAN replication thread will be parked if there are no events to replicate.- Parameters:
idleMinParkNs
- minimum duration in nanoseconds that the WAN replication thread will be parked- Returns:
- this config
-
getIdleMaxParkNs
public long getIdleMaxParkNs()Returns the maximum duration in nanoseconds that the WAN replication thread will be parked if there are no events to replicate.- Returns:
- maximum duration in nanoseconds that the WAN replication thread will be parked
-
setIdleMaxParkNs
Sets the maximum duration in nanoseconds that the WAN replication thread will be parked if there are no events to replicate.- Parameters:
idleMaxParkNs
- maximum duration in nanoseconds that the WAN replication thread will be parked- Returns:
- this config
-
getAwsConfig
Returns theAwsConfig
used by the discovery mechanism for this WAN publisher. -
setAwsConfig
Sets theAwsConfig
used by the discovery mechanism for this WAN publisher.- Parameters:
awsConfig
- the AWS discovery configuration- Returns:
- this config
- Throws:
IllegalArgumentException
- if awsConfig is null
-
getGcpConfig
Returns theGcpConfig
used by the discovery mechanism for this WAN publisher. -
setGcpConfig
Sets theGcpConfig
used by the discovery mechanism for this WAN publisher.- Parameters:
gcpConfig
- the GCP discovery configuration- Returns:
- this config
- Throws:
IllegalArgumentException
- if gcpConfig is null
-
getAzureConfig
Returns theAzureConfig
used by the discovery mechanism for this WAN publisher. -
setAzureConfig
Sets theAzureConfig
used by the discovery mechanism for this WAN publisher.- Parameters:
azureConfig
- the Azure discovery configuration- Returns:
- this config
- Throws:
IllegalArgumentException
- if azureConfig is null
-
getKubernetesConfig
Returns theKubernetesConfig
used by the discovery mechanism for this WAN publisher. -
setKubernetesConfig
Sets theKubernetesConfig
used by the discovery mechanism for this WAN publisher.- Parameters:
kubernetesConfig
- the Kubernetes discovery configuration- Returns:
- this config
- Throws:
IllegalArgumentException
- if kubernetesConfig is null
-
getEurekaConfig
Returns theEurekaConfig
used by the discovery mechanism for this WAN publisher. -
setEurekaConfig
Sets theEurekaConfig
used by the discovery mechanism for this WAN publisher.- Parameters:
eurekaConfig
- the Eureka discovery configuration- Returns:
- this config
- Throws:
IllegalArgumentException
- if eurekaConfig is null
-
getDiscoveryConfig
Returns the currently definedDiscoveryConfig
used by the discovery mechanism for this WAN publisher.- Returns:
- current DiscoveryProvidersConfig instance
-
setDiscoveryConfig
Sets theDiscoveryConfig
used by the discovery mechanism for this WAN publisher.- Parameters:
discoveryConfig
- configuration to set- Returns:
- this config
- Throws:
IllegalArgumentException
- if discoveryProvidersConfig is null
-
getEndpoint
Returns the WAN endpoint configuration qualifier. When using pre-3.12 network configuration, its value can benull
and is not taken into account. With 3.12+ advanced network config, anEndpointConfig
orServerSocketEndpointConfig
is looked up with protocol typeWAN
and this string as identifier. If such anEndpointConfig
is found, its configuration is used when the WAN publisher opens a connection to the target cluster members.- Returns:
- endpoint qualifier
- Since:
- 3.12
- See Also:
-
setEndpoint
Sets the WAN endpoint configuration qualifier. When using pre-3.12 network configuration, its value can benull
and is not taken into account. With 3.12+ advanced network config, anEndpointConfig
orServerSocketEndpointConfig
is looked up with protocol typeWAN
and this string as identifier. If such anEndpointConfig
is found, its configuration is used when the WAN publisher opens a connection to the target cluster members.- Parameters:
endpoint
- endpoint qualifier- Returns:
- this configuration
- Since:
- 3.12
- See Also:
-
toString
-
getFactoryId
public int getFactoryId()Description copied from interface:IdentifiedDataSerializable
Returns DataSerializableFactory factory ID for this class.- Returns:
- factory ID
-
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializable
Returns type identifier for this class. It should be unique per DataSerializableFactory.- Returns:
- type ID
-
writeData
Description copied from interface:DataSerializable
Writes object fields to output stream- Specified by:
writeData
in interfaceDataSerializable
- Overrides:
writeData
in classAbstractWanPublisherConfig
- Parameters:
out
- output- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializable
Reads fields from the input stream- Specified by:
readData
in interfaceDataSerializable
- Overrides:
readData
in classAbstractWanPublisherConfig
- Parameters:
in
- input- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the input stream has been closed.
-