Class WanBatchPublisherConfig

java.lang.Object
com.hazelcast.config.AbstractWanPublisherConfig
com.hazelcast.config.WanBatchPublisherConfig
All Implemented Interfaces:
DataSerializable, IdentifiedDataSerializable

public class WanBatchPublisherConfig extends AbstractWanPublisherConfig
Configuration object for the built-in WAN publisher (available in Hazelcast Enterprise). The publisher sends events to another Hazelcast cluster in batches, sending when either when enough events are enqueued or enqueued events have waited for enough time. The publisher can be a different cluster defined by static IP's or discovered using a cloud discovery mechanism.
See Also:
  • Field Details

    • DEFAULT_CLUSTER_NAME

      public static final String DEFAULT_CLUSTER_NAME
      See Also:
    • DEFAULT_SNAPSHOT_ENABLED

      public static final boolean DEFAULT_SNAPSHOT_ENABLED
      See Also:
    • DEFAULT_INITIAL_PUBLISHER_STATE

      public static final WanPublisherState 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

      public static final WanQueueFullBehavior DEFAULT_QUEUE_FULL_BEHAVIOUR
    • DEFAULT_ACKNOWLEDGE_TYPE

      public static final WanAcknowledgeType 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

      public static final String DEFAULT_TARGET_ENDPOINTS
      See Also:
  • Constructor Details

    • WanBatchPublisherConfig

      public WanBatchPublisherConfig()
  • Method Details

    • setClassName

      public WanBatchPublisherConfig setClassName(@Nonnull String className)
      Description copied from class: AbstractWanPublisherConfig
      Sets the name of the class implementing WanPublisher. To configure the built in WanBatchReplication, please use WanBatchPublisherConfig config class.
      Overrides:
      setClassName in class AbstractWanPublisherConfig
      Parameters:
      className - the name of the class implementation for the WAN replication
      Returns:
      this config
    • getImplementation

      public WanPublisher getImplementation()
      Description copied from class: AbstractWanPublisherConfig
      Returns the implementation of WanPublisher.
      Overrides:
      getImplementation in class AbstractWanPublisherConfig
    • setPublisherId

      public WanBatchPublisherConfig setPublisherId(String publisherId)
      Description copied from class: AbstractWanPublisherConfig
      Sets the publisher ID used for identifying the publisher in a WanReplicationConfig.
      Overrides:
      setPublisherId in class AbstractWanPublisherConfig
      Parameters:
      publisherId - the WAN publisher ID
      Returns:
      this config
    • setProperties

      public WanBatchPublisherConfig setProperties(@Nonnull Map<String,Comparable> properties)
      Description copied from class: AbstractWanPublisherConfig
      Sets the WAN publisher properties.
      Overrides:
      setProperties in class AbstractWanPublisherConfig
      Parameters:
      properties - WAN publisher properties
      Returns:
      this config
    • setImplementation

      public WanBatchPublisherConfig setImplementation(@Nonnull WanPublisher implementation)
      No-op method as the implementation cannot be changed for this publisher.
      Overrides:
      setImplementation in class AbstractWanPublisherConfig
      Parameters:
      implementation - the implementation for the WAN replication
      Returns:
      this config
    • getClusterName

      @Nonnull public String 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 a WanReplicationConfig.
      Returns:
      the WAN endpoint cluster name
      See Also:
    • setClusterName

      public WanBatchPublisherConfig setClusterName(@Nonnull String clusterName)
      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 a WanReplicationConfig.
      Parameters:
      clusterName - the WAN endpoint cluster name
      Returns:
      this config
      See Also:
    • isSnapshotEnabled

      public boolean isSnapshotEnabled()
      Returns true if key-based coalescing is configured for this WAN publisher. When enabled, only the latest WanEvent of a key is sent to target.
      See Also:
    • setSnapshotEnabled

      public WanBatchPublisherConfig setSnapshotEnabled(boolean snapshotEnabled)
      Sets if key-based coalescing is configured for this WAN publisher. When enabled, only the latest WanEvent 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

      public WanBatchPublisherConfig setBatchSize(int batchSize)
      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, if getBatchSize() of events have not arrived within this duration.
      Returns:
      maximum amount of time to wait before sending a batch of events
    • setBatchMaxDelayMillis

      public 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.
      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

      public 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.
      Parameters:
      responseTimeoutMillis - timeout for response from target cluster
      Returns:
      this config
    • getAcknowledgeType

      @Nonnull public WanAcknowledgeType getAcknowledgeType()
      Returns the strategy for when the target cluster should acknowledge that a WAN event batch has been processed.
      Returns:
      acknowledge type
    • setAcknowledgeType

      public WanBatchPublisherConfig setAcknowledgeType(@Nonnull WanAcknowledgeType acknowledgeType)
      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

      public String 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

      public WanBatchPublisherConfig setTargetEndpoints(String targetEndpoints)
      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

      public WanSyncConfig getSyncConfig()
      Returns the config for the WAN sync mechanism.
    • setSyncConfig

      public WanBatchPublisherConfig setSyncConfig(WanSyncConfig syncConfig)
      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 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().

      Returns:
      the queue capacity
    • setQueueCapacity

      public WanBatchPublisherConfig setQueueCapacity(int queueCapacity)
      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 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().

      Parameters:
      queueCapacity - the queue capacity
      Returns:
      this config
    • getQueueFullBehavior

      @Nonnull public WanQueueFullBehavior 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

      @Nonnull public WanPublisherState 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

      public WanBatchPublisherConfig setDiscoveryPeriodSeconds(int discoveryPeriodSeconds)
      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 using setTargetEndpoints(String).
      Returns:
      maximum number of endpoints that WAN will connect to
    • setMaxTargetEndpoints

      public WanBatchPublisherConfig setMaxTargetEndpoints(int maxTargetEndpoints)
      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 using setTargetEndpoints(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 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.

      Returns:
      the maximum number of WAN event batches being sent to the target cluster concurrently
    • setMaxConcurrentInvocations

      public WanBatchPublisherConfig setMaxConcurrentInvocations(int maxConcurrentInvocations)
      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 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.

      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 is false 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

      public WanBatchPublisherConfig setUseEndpointPrivateAddress(boolean useEndpointPrivateAddress)
      Sets whether the WAN connection manager should connect to the endpoint on the private address returned by the discovery SPI. By default this property is false 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

      public 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.
      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

      public 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.
      Parameters:
      idleMaxParkNs - maximum duration in nanoseconds that the WAN replication thread will be parked
      Returns:
      this config
    • getAwsConfig

      public AwsConfig getAwsConfig()
      Returns the AwsConfig used by the discovery mechanism for this WAN publisher.
    • setAwsConfig

      public WanBatchPublisherConfig setAwsConfig(AwsConfig awsConfig)
      Sets the AwsConfig 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

      public GcpConfig getGcpConfig()
      Returns the GcpConfig used by the discovery mechanism for this WAN publisher.
    • setGcpConfig

      public WanBatchPublisherConfig setGcpConfig(GcpConfig gcpConfig)
      Sets the GcpConfig 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

      public AzureConfig getAzureConfig()
      Returns the AzureConfig used by the discovery mechanism for this WAN publisher.
    • setAzureConfig

      public WanBatchPublisherConfig setAzureConfig(AzureConfig azureConfig)
      Sets the AzureConfig 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

      public KubernetesConfig getKubernetesConfig()
      Returns the KubernetesConfig used by the discovery mechanism for this WAN publisher.
    • setKubernetesConfig

      public WanBatchPublisherConfig setKubernetesConfig(KubernetesConfig kubernetesConfig)
      Sets the KubernetesConfig 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

      public EurekaConfig getEurekaConfig()
      Returns the EurekaConfig used by the discovery mechanism for this WAN publisher.
    • setEurekaConfig

      public WanBatchPublisherConfig setEurekaConfig(EurekaConfig eurekaConfig)
      Sets the EurekaConfig 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

      public DiscoveryConfig getDiscoveryConfig()
      Returns the currently defined DiscoveryConfig used by the discovery mechanism for this WAN publisher.
      Returns:
      current DiscoveryProvidersConfig instance
    • setDiscoveryConfig

      public WanBatchPublisherConfig setDiscoveryConfig(DiscoveryConfig discoveryConfig)
      Sets the DiscoveryConfig used by the discovery mechanism for this WAN publisher.
      Parameters:
      discoveryConfig - configuration to set
      Returns:
      this config
      Throws:
      IllegalArgumentException - if discoveryProvidersConfig is null
    • getEndpoint

      public String getEndpoint()
      Returns the WAN endpoint configuration qualifier. When using pre-3.12 network configuration, its value can be 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.
      Returns:
      endpoint qualifier
      Since:
      3.12
      See Also:
    • setEndpoint

      public WanBatchPublisherConfig setEndpoint(String endpoint)
      Sets the WAN endpoint configuration qualifier. When using pre-3.12 network configuration, its value can be 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.
      Parameters:
      endpoint - endpoint qualifier
      Returns:
      this configuration
      Since:
      3.12
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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

      public void writeData(ObjectDataOutput out) throws IOException
      Description copied from interface: DataSerializable
      Writes object fields to output stream
      Specified by:
      writeData in interface DataSerializable
      Overrides:
      writeData in class AbstractWanPublisherConfig
      Parameters:
      out - output
      Throws:
      IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
    • readData

      public void readData(ObjectDataInput in) throws IOException
      Description copied from interface: DataSerializable
      Reads fields from the input stream
      Specified by:
      readData in interface DataSerializable
      Overrides:
      readData in class AbstractWanPublisherConfig
      Parameters:
      in - input
      Throws:
      IOException - if an I/O error occurs. In particular, an IOException may be thrown if the input stream has been closed.