Interface KeyValueEntity.Effect.OnSuccessBuilder<S>

Type Parameters:
S - The type of the state for this entity
Enclosing interface:
KeyValueEntity.Effect<T>

public static interface KeyValueEntity.Effect.OnSuccessBuilder<S>
Builder for chaining a reply after a successful state operation like updateState or deleteEntity. This allows you to both modify the entity and send a response to the caller in a single effect.
  • Method Details

    • thenReply

      <T> KeyValueEntity.Effect<T> thenReply(T message)
      Sends a reply message to the caller after the state operation (update or delete) completes successfully. This is typically used to confirm the operation and return the new state or operation result.
      Type Parameters:
      T - the type of the reply message
      Parameters:
      message - the payload of the reply message
      Returns:
      an effect that will perform the state operation and then send the reply
    • thenReply

      <T> KeyValueEntity.Effect<T> thenReply(T message, Metadata metadata)
      Sends a reply message with additional metadata to the caller after the state operation completes successfully.
      Type Parameters:
      T - the type of the reply message
      Parameters:
      message - the payload of the reply message
      metadata - additional metadata to include with the reply
      Returns:
      an effect that will perform the state operation and then send the reply
    • updateReplicationFilter

      Change the replication filter for this entity, combined with updating state.

      State us by default replicated to all regions that have been enabled for the service. This method allows you to control which regions participate in the replication for this specific entity instance. This is useful for regulatory reasons or as cost optimization.

      This effect can be combined with updating the state. For example, you can update the state and then update the replication filter in the same command handler.

      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.

      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.

      Parameters:
      filter - the replication filter defining which regions to include or exclude
      Returns:
      an effect builder for chaining additional operations