Class WanBatchPublisherConfig
- All Implemented Interfaces:
DataSerializable,IdentifiedDataSerializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final WanAcknowledgeTypestatic final intstatic final intstatic final Stringstatic final intstatic final longstatic final longstatic final WanPublisherStatestatic final intstatic final intstatic final intstatic final WanQueueFullBehaviorstatic final intstatic final booleanstatic final Stringstatic final booleanFields inherited from class com.hazelcast.config.AbstractWanPublisherConfig
className, implementation, properties, publisherId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the strategy for when the target cluster should acknowledge that a WAN event batch has been processed.Returns theAwsConfigused by the discovery mechanism for this WAN publisher.Returns theAzureConfigused by the discovery mechanism for this WAN publisher.intReturns 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.intReturns the maximum batch size that can be sent to target cluster.intReturns type identifier for this class.Returns the cluster name used as a publisher cluster name for authentication on the target endpoint.Returns the currently definedDiscoveryConfigused by the discovery mechanism for this WAN publisher.intReturns 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 theEurekaConfigused by the discovery mechanism for this WAN publisher.intReturns DataSerializableFactory factory ID for this class.Returns theGcpConfigused by the discovery mechanism for this WAN publisher.longReturns the maximum duration in nanoseconds that the WAN replication thread will be parked if there are no events to replicate.longReturns 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 theKubernetesConfigused by the discovery mechanism for this WAN publisher.intReturns the maximum number of WAN event batches being sent to the target cluster concurrently.intReturns the maximum number of endpoints that WAN will connect to when using a discovery mechanism to define endpoints.intReturns 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.intReturns 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.booleanReturnstrueif key-based coalescing is configured for this WAN publisher.booleanReturns whether the WAN connection manager should connect to the endpoint on the private address returned by the discovery SPI.voidReads 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 theAwsConfigused by the discovery mechanism for this WAN publisher.setAzureConfig(AzureConfig azureConfig) Sets theAzureConfigused 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 theDiscoveryConfigused 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 theEurekaConfigused by the discovery mechanism for this WAN publisher.setGcpConfig(GcpConfig gcpConfig) Sets theGcpConfigused 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 theKubernetesConfigused 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()voidWrites 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:AbstractWanPublisherConfigSets the name of the class implementingWanPublisher. To configure the built-in WanBatchReplication, please useWanBatchPublisherConfigconfig class.- Overrides:
setClassNamein classAbstractWanPublisherConfig- Parameters:
className- the name of the class implementation for the WAN replication- Returns:
- this config
-
getImplementation
Description copied from class:AbstractWanPublisherConfigReturns the implementation ofWanPublisher.- Overrides:
getImplementationin classAbstractWanPublisherConfig
-
setPublisherId
Description copied from class:AbstractWanPublisherConfigSets the publisher ID used for identifying the publisher in aWanReplicationConfig.- Overrides:
setPublisherIdin classAbstractWanPublisherConfig- Parameters:
publisherId- the WAN publisher ID- Returns:
- this config
-
setProperties
Description copied from class:AbstractWanPublisherConfigSets the WAN publisher properties.- Overrides:
setPropertiesin classAbstractWanPublisherConfig- Parameters:
properties- WAN publisher properties- Returns:
- this config
-
setImplementation
No-op method as the implementation cannot be changed for this publisher.- Overrides:
setImplementationin 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()Returnstrueif key-based coalescing is configured for this WAN publisher. When enabled, only the latestWanEventof a key is sent to target.- See Also:
-
setSnapshotEnabled
Sets if key-based coalescing is configured for this WAN publisher. When enabled, only the latestWanEventof 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*queueCapacityevents since we keep up toqueueCapacityprimary events (events with keys for which the instance is the owner) andqueueCapacitybackup 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*queueCapacityevents since we keep up toqueueCapacityprimary events (events with keys for which the instance is the owner) andqueueCapacitybackup 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
2will 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
2or 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 than2in 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
2will 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
2or 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 than2in 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 isfalsewhich means the WAN connection manager will always use the public address.- Returns:
trueif 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 isfalsewhich 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 theAwsConfigused by the discovery mechanism for this WAN publisher. -
setAwsConfig
Sets theAwsConfigused 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 theGcpConfigused by the discovery mechanism for this WAN publisher. -
setGcpConfig
Sets theGcpConfigused 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 theAzureConfigused by the discovery mechanism for this WAN publisher. -
setAzureConfig
Sets theAzureConfigused 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 theKubernetesConfigused by the discovery mechanism for this WAN publisher. -
setKubernetesConfig
Sets theKubernetesConfigused 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 theEurekaConfigused by the discovery mechanism for this WAN publisher. -
setEurekaConfig
Sets theEurekaConfigused 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 definedDiscoveryConfigused by the discovery mechanism for this WAN publisher.- Returns:
- current DiscoveryProvidersConfig instance
-
setDiscoveryConfig
Sets theDiscoveryConfigused 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 benulland is not taken into account. With 3.12+ advanced network config, anEndpointConfigorServerSocketEndpointConfigis looked up with protocol typeWANand this string as identifier. If such anEndpointConfigis 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 benulland is not taken into account. With 3.12+ advanced network config, anEndpointConfigorServerSocketEndpointConfigis looked up with protocol typeWANand this string as identifier. If such anEndpointConfigis 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:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Returns:
- factory ID
-
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializableReturns type identifier for this class. It should be unique per DataSerializableFactory.- Returns:
- type ID
-
writeData
Description copied from interface:DataSerializableWrites object fields to output stream- Specified by:
writeDatain interfaceDataSerializable- Overrides:
writeDatain classAbstractWanPublisherConfig- Parameters:
out- output- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializableReads fields from the input stream- Specified by:
readDatain interfaceDataSerializable- Overrides:
readDatain classAbstractWanPublisherConfig- Parameters:
in- input- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the input stream has been closed.
-