Package kalix.javasdk.replicatedentity
Interface ReplicatedEntity.Effect.Builder<D>
- Type Parameters:
D
- The replicated data type for this entity.
- Enclosing interface:
- ReplicatedEntity.Effect<R>
public static interface ReplicatedEntity.Effect.Builder<D>
Construct the effect that is returned by the command handler. The effect describes next
processing actions, such as sending a reply or deleting an entity.
-
Method Summary
Modifier and TypeMethodDescriptiondelete()
Delete the replicated entity.<T> ReplicatedEntity.Effect<T>
Create an error reply.<T> ReplicatedEntity.Effect<T>
Create an error reply.<T> ReplicatedEntity.Effect<T>
error
(String description, StatusCode.ErrorCode httpErrorCode) Create an error reply with a custom status code.<T> ReplicatedEntity.Effect<T>
forward
(DeferredCall<? extends Object, T> serviceCall) Create a forward reply.<T> ReplicatedEntity.Effect<T>
reply
(T message) Create a message reply.<T> ReplicatedEntity.Effect<T>
Create a message reply.Update the underlying replicated data for the replicated entity.
-
Method Details
-
update
Update the underlying replicated data for the replicated entity. -
delete
Delete the replicated entity.When a replicated entity is deleted, it may not be created again. Additionally, replicated entity deletion results in tombstones that get accumulated for the life of the cluster. If you expect to delete replicated entities frequently, it's recommended that you store them in a single or sharded
ReplicatedMap
, rather than individual replicated entities. -
reply
Create a message reply.- Type Parameters:
T
- The type of the message that must be returned by this call.- Parameters:
message
- The payload of the reply.- Returns:
- A message reply.
-
reply
Create a message reply.- Type Parameters:
T
- The type of the message that must be returned by this call.- Parameters:
message
- The payload of the reply.metadata
- The metadata for the message.- Returns:
- A message reply.
-
forward
Create a forward reply.- Type Parameters:
T
- The type of the message that must be returned by this call.- Parameters:
serviceCall
- The service call representing the forward.- Returns:
- A forward reply.
-
error
Create an error reply.- Type Parameters:
T
- The type of the message that must be returned by this call.- Parameters:
description
- The description of the error.- Returns:
- An error reply.
-
error
Create an error reply.- Type Parameters:
T
- The type of the message that must be returned by this call.- Parameters:
description
- The description of the error.grpcErrorCode
- A custom gRPC status code.- Returns:
- An error reply.
-
error
Create an error reply with a custom status code. This status code will be translated to an HTTP or gRPC code depending on the type of service being exposed.- Type Parameters:
T
- The type of the message that must be returned by this call.- Parameters:
description
- The description of the error.httpErrorCode
- A custom Kalix status code to represent the error.- Returns:
- An error reply.
-