Interface EventSourcedEntity.Effect.OnSuccessBuilder<S>
- Enclosing interface:
EventSourcedEntity.Effect<T>
-
Method Summary
Modifier and TypeMethodDescriptionDelete the entity.<T> EventSourcedEntity.Effect<T> Reply after for examplepersistevent.<T> EventSourcedEntity.Effect<T> Reply after for examplepersistevent.Change the replication filter for this entity, combined with persisting events.
-
Method Details
-
deleteEntity
EventSourcedEntity.Effect.OnSuccessBuilder<S> deleteEntity()Delete the entity. No addition events are allowed. To observe the deletion in consumers and views, persist a final event representing the deletion before triggering delete. -
thenReply
Reply after for examplepersistevent.- Type Parameters:
T- The type of the message that must be returned by this call.- Parameters:
replyMessage- Function to create the reply message from the new state.- Returns:
- A message reply.
-
thenReply
Reply after for examplepersistevent.- Type Parameters:
T- The type of the message that must be returned by this call.- Parameters:
replyMessage- Function to create the reply message from the new state.metadata- The metadata for the message.- Returns:
- A message reply.
-
updateReplicationFilter
EventSourcedEntity.Effect.OnSuccessBuilder<S> updateReplicationFilter(ReplicationFilter.Builder filter) Change the replication filter for this entity, combined with persisting events.Events are 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 persisting events. For example, you can persist an event 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
-