public class WanBatchPublisherConfig extends AbstractWanPublisherConfig
DiscoveryConfig
,
AwsConfig
Modifier and Type | Field and Description |
---|---|
static WanAcknowledgeType |
DEFAULT_ACKNOWLEDGE_TYPE |
static int |
DEFAULT_BATCH_MAX_DELAY_MILLIS |
static int |
DEFAULT_BATCH_SIZE |
static String |
DEFAULT_CLUSTER_NAME |
static int |
DEFAULT_DISCOVERY_PERIOD_SECONDS |
static long |
DEFAULT_IDLE_MAX_PARK_NS |
static long |
DEFAULT_IDLE_MIN_PARK_NS |
static WanPublisherState |
DEFAULT_INITIAL_PUBLISHER_STATE |
static int |
DEFAULT_MAX_CONCURRENT_INVOCATIONS |
static int |
DEFAULT_MAX_TARGET_ENDPOINTS |
static int |
DEFAULT_QUEUE_CAPACITY |
static WanQueueFullBehavior |
DEFAULT_QUEUE_FULL_BEHAVIOUR |
static int |
DEFAULT_RESPONSE_TIMEOUT_MILLIS |
static boolean |
DEFAULT_SNAPSHOT_ENABLED |
static String |
DEFAULT_TARGET_ENDPOINTS |
static boolean |
DEFAULT_USE_ENDPOINT_PRIVATE_ADDRESS |
className, implementation, properties, publisherId
Constructor and Description |
---|
WanBatchPublisherConfig() |
Modifier and Type | Method and Description |
---|---|
WanAcknowledgeType |
getAcknowledgeType()
Returns the strategy for when the target cluster should acknowledge that
a WAN event batch has been processed.
|
AwsConfig |
getAwsConfig()
Returns the
AwsConfig used by the discovery mechanism for this
WAN publisher. |
AzureConfig |
getAzureConfig()
Returns the
AzureConfig used by the discovery mechanism for this
WAN publisher. |
int |
getBatchMaxDelayMillis()
Returns the maximum amount of time in milliseconds to wait before sending
a batch of events to target cluster, if
getBatchSize() of events
have not arrived within this duration. |
int |
getBatchSize()
Returns the maximum batch size that can be sent to target cluster.
|
int |
getClassId()
Returns type identifier for this class.
|
String |
getClusterName()
Returns the cluster name used as a publisher cluster name for authentication
on the target endpoint.
|
DiscoveryConfig |
getDiscoveryConfig()
Returns the currently defined
DiscoveryConfig used by the
discovery mechanism for this WAN publisher. |
int |
getDiscoveryPeriodSeconds()
Returns the period in seconds in which WAN tries to discover new target
endpoints and reestablish connections to failed endpoints.
|
String |
getEndpoint()
Returns the WAN endpoint configuration qualifier.
|
EurekaConfig |
getEurekaConfig()
Returns the
EurekaConfig used by the discovery mechanism for this
WAN publisher. |
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
GcpConfig |
getGcpConfig()
Returns the
GcpConfig used by the discovery mechanism for this
WAN publisher. |
long |
getIdleMaxParkNs()
Returns the maximum duration in nanoseconds that the WAN replication thread
will be parked if there are no events to replicate.
|
long |
getIdleMinParkNs()
Returns the minimum duration in nanoseconds that the WAN replication thread
will be parked if there are no events to replicate.
|
WanPublisher |
getImplementation()
Returns the implementation of
WanPublisher . |
WanPublisherState |
getInitialPublisherState()
Returns the initial WAN publisher state.
|
KubernetesConfig |
getKubernetesConfig()
Returns the
KubernetesConfig used by the discovery mechanism for this
WAN publisher. |
int |
getMaxConcurrentInvocations()
Returns the maximum number of WAN event batches being sent to the target
cluster concurrently.
|
int |
getMaxTargetEndpoints()
Returns the maximum number of endpoints that WAN will connect to when
using a discovery mechanism to define endpoints.
|
int |
getQueueCapacity()
Returns the capacity of the primary and backup queue for WAN replication events.
|
WanQueueFullBehavior |
getQueueFullBehavior()
Returns the configured behaviour of this WAN publisher when the WAN queue
is full.
|
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.
|
WanSyncConfig |
getSyncConfig()
Returns the config for the WAN sync mechanism.
|
String |
getTargetEndpoints()
Returns the comma separated list of target cluster members,
e.g.
|
boolean |
isSnapshotEnabled()
Returns
true if key-based coalescing is configured for this WAN
publisher. |
boolean |
isUseEndpointPrivateAddress()
Returns whether the WAN connection manager should connect to the
endpoint on the private address returned by the discovery SPI.
|
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
WanBatchPublisherConfig |
setAcknowledgeType(WanAcknowledgeType acknowledgeType)
Sets the strategy for when the target cluster should acknowledge that
a WAN event batch has been processed.
|
WanBatchPublisherConfig |
setAwsConfig(AwsConfig awsConfig)
Sets the
AwsConfig used by the discovery mechanism for this
WAN publisher. |
WanBatchPublisherConfig |
setAzureConfig(AzureConfig azureConfig)
Sets the
AzureConfig used by the discovery mechanism for this
WAN publisher. |
WanBatchPublisherConfig |
setBatchMaxDelayMillis(int batchMaxDelayMillis)
Sets the maximum amount of time in milliseconds to wait before sending a
batch of events to target cluster, if
getBatchSize() of events
have not arrived within this duration. |
WanBatchPublisherConfig |
setBatchSize(int batchSize)
Sets the maximum batch size that can be sent to target cluster.
|
WanBatchPublisherConfig |
setClassName(String className)
Sets the name of the class implementing
WanPublisher . |
WanBatchPublisherConfig |
setClusterName(String clusterName)
Sets the cluster name used as an endpoint group password for authentication
on the target endpoint.
|
WanBatchPublisherConfig |
setDiscoveryConfig(DiscoveryConfig discoveryConfig)
Sets the
DiscoveryConfig used by the discovery mechanism for
this WAN publisher. |
WanBatchPublisherConfig |
setDiscoveryPeriodSeconds(int discoveryPeriodSeconds)
Sets the period in seconds in which WAN tries to discover new target
endpoints and reestablish connections to failed endpoints.
|
WanBatchPublisherConfig |
setEndpoint(String endpoint)
Sets the WAN endpoint configuration qualifier.
|
WanBatchPublisherConfig |
setEurekaConfig(EurekaConfig eurekaConfig)
Sets the
EurekaConfig used by the discovery mechanism for this
WAN publisher. |
WanBatchPublisherConfig |
setGcpConfig(GcpConfig gcpConfig)
Sets the
GcpConfig used by the discovery mechanism for this
WAN publisher. |
WanBatchPublisherConfig |
setIdleMaxParkNs(long idleMaxParkNs)
Sets the maximum duration in nanoseconds that the WAN replication thread
will be parked if there are no events to replicate.
|
WanBatchPublisherConfig |
setIdleMinParkNs(long idleMinParkNs)
Sets the minimum duration in nanoseconds that the WAN replication thread
will be parked if there are no events to replicate.
|
WanBatchPublisherConfig |
setImplementation(WanPublisher implementation)
No-op method as the implementation cannot be changed for this publisher.
|
WanBatchPublisherConfig |
setInitialPublisherState(WanPublisherState initialPublisherState)
Sets the initial publisher state.
|
WanBatchPublisherConfig |
setKubernetesConfig(KubernetesConfig kubernetesConfig)
Sets the
KubernetesConfig used by the discovery mechanism for this
WAN publisher. |
WanBatchPublisherConfig |
setMaxConcurrentInvocations(int maxConcurrentInvocations)
Sets the maximum number of WAN event batches being sent to the target
cluster concurrently.
|
WanBatchPublisherConfig |
setMaxTargetEndpoints(int maxTargetEndpoints)
Sets the maximum number of endpoints that WAN will connect to when
using a discovery mechanism to define endpoints.
|
WanBatchPublisherConfig |
setProperties(Map<String,Comparable> properties)
Sets the WAN publisher properties.
|
WanBatchPublisherConfig |
setPublisherId(String publisherId)
Sets the publisher ID used for identifying the publisher in a
WanReplicationConfig . |
WanBatchPublisherConfig |
setQueueCapacity(int queueCapacity)
Sets the capacity of the primary and backup queue for WAN replication events.
|
WanBatchPublisherConfig |
setQueueFullBehavior(WanQueueFullBehavior queueFullBehavior)
Sets the configured behaviour of this WAN publisher when the WAN queue is
full.
|
WanBatchPublisherConfig |
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.
|
WanBatchPublisherConfig |
setSnapshotEnabled(boolean snapshotEnabled)
Sets if key-based coalescing is configured for this WAN publisher.
|
WanBatchPublisherConfig |
setSyncConfig(WanSyncConfig syncConfig)
Sets the config for the WAN sync mechanism.
|
WanBatchPublisherConfig |
setTargetEndpoints(String targetEndpoints)
Sets the comma separated list of target cluster members,
e.g.
|
WanBatchPublisherConfig |
setUseEndpointPrivateAddress(boolean useEndpointPrivateAddress)
Sets whether the WAN connection manager should connect to the
endpoint on the private address returned by the discovery SPI.
|
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
equals, getClassName, getProperties, getPublisherId, hashCode
public static final String DEFAULT_CLUSTER_NAME
public static final boolean DEFAULT_SNAPSHOT_ENABLED
public static final WanPublisherState DEFAULT_INITIAL_PUBLISHER_STATE
public static final int DEFAULT_QUEUE_CAPACITY
public static final int DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_MAX_DELAY_MILLIS
public static final int DEFAULT_RESPONSE_TIMEOUT_MILLIS
public static final WanQueueFullBehavior DEFAULT_QUEUE_FULL_BEHAVIOUR
public static final WanAcknowledgeType DEFAULT_ACKNOWLEDGE_TYPE
public static final int DEFAULT_DISCOVERY_PERIOD_SECONDS
public static final int DEFAULT_MAX_TARGET_ENDPOINTS
public static final int DEFAULT_MAX_CONCURRENT_INVOCATIONS
public static final boolean DEFAULT_USE_ENDPOINT_PRIVATE_ADDRESS
public static final long DEFAULT_IDLE_MIN_PARK_NS
public static final long DEFAULT_IDLE_MAX_PARK_NS
public static final String DEFAULT_TARGET_ENDPOINTS
public WanBatchPublisherConfig setClassName(@Nonnull String className)
AbstractWanPublisherConfig
WanPublisher
.
To configure the built in WanBatchReplication, please use
WanBatchPublisherConfig
config class.setClassName
in class AbstractWanPublisherConfig
className
- the name of the class implementation for the WAN replicationpublic WanPublisher getImplementation()
AbstractWanPublisherConfig
WanPublisher
.getImplementation
in class AbstractWanPublisherConfig
public WanBatchPublisherConfig setPublisherId(String publisherId)
AbstractWanPublisherConfig
WanReplicationConfig
.setPublisherId
in class AbstractWanPublisherConfig
publisherId
- the WAN publisher IDpublic WanBatchPublisherConfig setProperties(@Nonnull Map<String,Comparable> properties)
AbstractWanPublisherConfig
setProperties
in class AbstractWanPublisherConfig
properties
- WAN publisher propertiespublic WanBatchPublisherConfig setImplementation(@Nonnull WanPublisher implementation)
setImplementation
in class AbstractWanPublisherConfig
implementation
- the implementation for the WAN replication@Nonnull public String getClusterName()
WanReplicationConfig
.AbstractWanPublisherConfig.getPublisherId()
public WanBatchPublisherConfig setClusterName(@Nonnull String clusterName)
WanReplicationConfig
.clusterName
- the WAN endpoint cluster nameAbstractWanPublisherConfig.getPublisherId()
public boolean isSnapshotEnabled()
true
if key-based coalescing is configured for this WAN
publisher.
When enabled, only the latest WanEvent
of a key is sent to target.isSnapshotEnabled()
public WanBatchPublisherConfig setSnapshotEnabled(boolean snapshotEnabled)
WanEvent
of a key is sent to target.isSnapshotEnabled()
public int getBatchSize()
public WanBatchPublisherConfig setBatchSize(int batchSize)
batchSize
- the maximum size of a WAN event batchpublic int getBatchMaxDelayMillis()
getBatchSize()
of events
have not arrived within this duration.public WanBatchPublisherConfig setBatchMaxDelayMillis(int batchMaxDelayMillis)
getBatchSize()
of events
have not arrived within this duration.batchMaxDelayMillis
- maximum amount of time to wait before sending a batch of eventspublic int getResponseTimeoutMillis()
public WanBatchPublisherConfig setResponseTimeoutMillis(int responseTimeoutMillis)
responseTimeoutMillis
- timeout for response from target cluster@Nonnull public WanAcknowledgeType getAcknowledgeType()
public WanBatchPublisherConfig setAcknowledgeType(@Nonnull WanAcknowledgeType acknowledgeType)
acknowledgeType
- acknowledge typepublic String getTargetEndpoints()
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.getAwsConfig()
,
getGcpConfig()
,
getAzureConfig()
,
getKubernetesConfig()
,
getEurekaConfig()
,
getDiscoveryConfig()
public WanBatchPublisherConfig setTargetEndpoints(String targetEndpoints)
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.targetEndpoints
- comma separated listsetAwsConfig(AwsConfig)
,
setGcpConfig(GcpConfig)
,
setAzureConfig(AzureConfig)
,
setKubernetesConfig(KubernetesConfig)
,
setEurekaConfig(EurekaConfig)
,
setDiscoveryConfig(DiscoveryConfig)
public WanSyncConfig getSyncConfig()
public WanBatchPublisherConfig setSyncConfig(WanSyncConfig syncConfig)
syncConfig
- the WAN sync configpublic int getQueueCapacity()
One hazelcast instance can have up to 2*queueCapacity
events since
we keep up to queueCapacity
primary events (events with keys for
which the instance is the owner) and queueCapacity
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()
.
public WanBatchPublisherConfig setQueueCapacity(int queueCapacity)
One hazelcast instance can have up to 2*queueCapacity
events since
we keep up to queueCapacity
primary events (events with keys for
which the instance is the owner) and queueCapacity
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()
.
queueCapacity
- the queue capacity@Nonnull public WanQueueFullBehavior getQueueFullBehavior()
public WanBatchPublisherConfig setQueueFullBehavior(@Nonnull WanQueueFullBehavior queueFullBehavior)
queueFullBehavior
- the behaviour of this publisher when the WAN queue is full@Nonnull public WanPublisherState getInitialPublisherState()
public WanBatchPublisherConfig setInitialPublisherState(@Nonnull WanPublisherState initialPublisherState)
initialPublisherState
- the statepublic int getDiscoveryPeriodSeconds()
public WanBatchPublisherConfig setDiscoveryPeriodSeconds(int discoveryPeriodSeconds)
discoveryPeriodSeconds
- period for retrying connections to target endpointspublic int getMaxTargetEndpoints()
setTargetEndpoints(String)
.public WanBatchPublisherConfig setMaxTargetEndpoints(int maxTargetEndpoints)
setTargetEndpoints(String)
.maxTargetEndpoints
- maximum number of endpoints that WAN will connect topublic int getMaxConcurrentInvocations()
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 than 3
. Otherwise, you can simply disable it
by setting it to less than 2
in which case WAN will use the
default replication strategy and adapt to the target endpoint count
while maintaining causality.
public WanBatchPublisherConfig setMaxConcurrentInvocations(int maxConcurrentInvocations)
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 than 3
. Otherwise, you can simply disable it
by setting it to less than 2
in which case WAN will use the
default replication strategy and adapt to the target endpoint count
while maintaining causality.
maxConcurrentInvocations
- the maximum number of WAN event batches being sent to the target cluster
concurrentlypublic boolean isUseEndpointPrivateAddress()
false
which means the WAN connection
manager will always use the public address.true
if the WAN connection manager should connect to the endpoint
on the private address returned by the discovery SPIDiscoveryNode.getPublicAddress()
,
DiscoveryNode.getPrivateAddress()
public WanBatchPublisherConfig setUseEndpointPrivateAddress(boolean useEndpointPrivateAddress)
false
which means the WAN connection
manager will always use the public address.DiscoveryNode.getPublicAddress()
,
DiscoveryNode.getPrivateAddress()
public long getIdleMinParkNs()
public WanBatchPublisherConfig setIdleMinParkNs(long idleMinParkNs)
idleMinParkNs
- minimum duration in nanoseconds that the WAN replication thread will be
parkedpublic long getIdleMaxParkNs()
public WanBatchPublisherConfig setIdleMaxParkNs(long idleMaxParkNs)
idleMaxParkNs
- maximum duration in nanoseconds that the WAN replication thread will be
parkedpublic AwsConfig getAwsConfig()
AwsConfig
used by the discovery mechanism for this
WAN publisher.public WanBatchPublisherConfig setAwsConfig(AwsConfig awsConfig)
AwsConfig
used by the discovery mechanism for this
WAN publisher.awsConfig
- the AWS discovery configurationIllegalArgumentException
- if awsConfig is nullpublic GcpConfig getGcpConfig()
GcpConfig
used by the discovery mechanism for this
WAN publisher.public WanBatchPublisherConfig setGcpConfig(GcpConfig gcpConfig)
GcpConfig
used by the discovery mechanism for this
WAN publisher.gcpConfig
- the GCP discovery configurationIllegalArgumentException
- if gcpConfig is nullpublic AzureConfig getAzureConfig()
AzureConfig
used by the discovery mechanism for this
WAN publisher.public WanBatchPublisherConfig setAzureConfig(AzureConfig azureConfig)
AzureConfig
used by the discovery mechanism for this
WAN publisher.azureConfig
- the Azure discovery configurationIllegalArgumentException
- if azureConfig is nullpublic KubernetesConfig getKubernetesConfig()
KubernetesConfig
used by the discovery mechanism for this
WAN publisher.public WanBatchPublisherConfig setKubernetesConfig(KubernetesConfig kubernetesConfig)
KubernetesConfig
used by the discovery mechanism for this
WAN publisher.kubernetesConfig
- the Kubernetes discovery configurationIllegalArgumentException
- if kubernetesConfig is nullpublic EurekaConfig getEurekaConfig()
EurekaConfig
used by the discovery mechanism for this
WAN publisher.public WanBatchPublisherConfig setEurekaConfig(EurekaConfig eurekaConfig)
EurekaConfig
used by the discovery mechanism for this
WAN publisher.eurekaConfig
- the Eureka discovery configurationIllegalArgumentException
- if eurekaConfig is nullpublic DiscoveryConfig getDiscoveryConfig()
DiscoveryConfig
used by the
discovery mechanism for this WAN publisher.public WanBatchPublisherConfig setDiscoveryConfig(DiscoveryConfig discoveryConfig)
DiscoveryConfig
used by the discovery mechanism for
this WAN publisher.discoveryConfig
- configuration to setIllegalArgumentException
- if discoveryProvidersConfig is nullpublic String getEndpoint()
null
and is not taken into account.
With 3.12+ advanced network config, an EndpointConfig
or
ServerSocketEndpointConfig
is looked up with protocol type
WAN
and this string as identifier. If such an EndpointConfig
is found, its configuration is used when the WAN publisher opens a
connection to the target cluster members.NetworkConfig
,
AdvancedNetworkConfig
public WanBatchPublisherConfig setEndpoint(String endpoint)
null
and is not taken into account.
With 3.12+ advanced network config, an EndpointConfig
or
ServerSocketEndpointConfig
is looked up with protocol type
WAN
and this string as identifier. If such an EndpointConfig
is found, its configuration is used when the WAN publisher opens a
connection to the target cluster members.endpoint
- endpoint qualifierNetworkConfig
,
AdvancedNetworkConfig
public int getFactoryId()
IdentifiedDataSerializable
public int getClassId()
IdentifiedDataSerializable
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
writeData
in class AbstractWanPublisherConfig
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
readData
in class AbstractWanPublisherConfig
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.Copyright © 2023 Hazelcast, Inc.. All rights reserved.