Interface ReplicationFilter


public interface ReplicationFilter
Replication filter for controlling which regions participate in replication for a Key Value Entity. To enable this feature you must add @EnableReplicationFilter annotation to the KeyValueEntity class, and use the updateReplicationFilter in the entity effects.

State is by default replicated to all regions that have been enabled for the service. For regulatory reasons or as cost optimization, it is possible to filter which regions participate in the replication for a specific entity. This can be changed at runtime by the entity itself.

The replication filter can only be updated from the primary region of the entity, or the entity will become the primary if using the request-region primary selection strategy. The filter is durable for the specific entity instance and can be changed without deploying a new version.

When you define the replication filter, you specify the regions to be included or excluded in the replication. The region where the update is made (the self region) is automatically included in the replication filter. The changes are additive, meaning that if you first update the filter to include one region and then later make another update to include a different region from the same entity, both regions are included.

After enabling replication filter with the @EnableReplicationFilter annotation, the entity will still replicate to all regions until specific regions are defined with the updateReplicationFilter effect.

  • Method Details

    • empty

      static ReplicationFilter.Builder empty()
      Creates an empty replication filter.
      Returns:
      an empty replication filter
    • includeRegion

      static ReplicationFilter.Builder includeRegion(String region)
      Creates a replication filter that includes the specified region.
      Parameters:
      region - the region to include in the replication filter
      Returns:
      a replication filter with the specified region included
    • includeRegions

      static ReplicationFilter.Builder includeRegions(Set<String> regions)
      Creates a replication filter that includes the specified regions.
      Parameters:
      regions - the regions to include in the replication filter
      Returns:
      a replication filter with the specified regions included
    • excludeRegion

      static ReplicationFilter.Builder excludeRegion(String region)
      Creates a replication filter that excludes the specified region.
      Parameters:
      region - the region to exclude from the replication filter
      Returns:
      a replication filter with the specified region excluded
    • excludeRegions

      static ReplicationFilter.Builder excludeRegions(Set<String> regions)
      Creates a replication filter that excludes the specified regions.
      Parameters:
      regions - the regions to exclude from the replication filter
      Returns:
      a replication filter with the specified regions excluded