Interface Action.Effect.Builder

Enclosing interface:
Action.Effect<T>

public static interface Action.Effect.Builder
Construct the effect that is returned by the command handler. The effect describes next processing actions, such as sending a reply.
  • Method Details

    • reply

      <S> Action.Effect<S> reply(S message)
      Create a message reply.
      Type Parameters:
      S - The type of the message that must be returned by this call.
      Parameters:
      message - The payload of the reply.
      Returns:
      A message reply.
    • reply

      <S> Action.Effect<S> reply(S message, Metadata metadata)
      Create a message reply with custom Metadata.
      Type Parameters:
      S - 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

      <S> Action.Effect<S> forward(DeferredCall<? extends Object,S> serviceCall)
      Create a forward reply.
      Type Parameters:
      S - 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

      <S> Action.Effect<S> error(String description)
      Create an error reply.
      Type Parameters:
      S - The type of the message that must be returned by this call.
      Parameters:
      description - The description of the error.
      Returns:
      An error reply.
    • error

      <T> Action.Effect<T> error(String description, io.grpc.Status.Code grpcErrorCode)
      Create an error reply with a custom gRPC status code.
      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

      <T> Action.Effect<T> error(String description, StatusCode.ErrorCode httpErrorCode)
      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.
    • asyncReply

      <S> Action.Effect<S> asyncReply(CompletionStage<S> message)
      Create a message reply from an async operation result.
      Type Parameters:
      S - The type of the message that must be returned by this call.
      Parameters:
      message - The future payload of the reply.
      Returns:
      A message reply.
    • asyncReply

      <S> Action.Effect<S> asyncReply(CompletionStage<S> message, Metadata metadata)
      Create a message reply from an async operation result with custom Metadata.
      Type Parameters:
      S - The type of the message that must be returned by this call.
      Parameters:
      message - The future payload of the reply.
      metadata - The metadata for the message.
      Returns:
      A message reply.
    • asyncEffect

      <S> Action.Effect<S> asyncEffect(CompletionStage<Action.Effect<S>> futureEffect)
      Create a reply from an async operation result returning an effect.
      Type Parameters:
      S - The type of the message that must be returned by this call.
      Parameters:
      futureEffect - The future effect to reply with.
      Returns:
      A reply, the actual type depends on the nested Effect.
    • ignore

      <S> Action.Effect<S> ignore()
      Ignore the current element and proceed with processing the next element if returned for an element from a subscription. If used as a response to a regular gRPC or HTTP request it is turned into a NotFound response.

      Ignore is not allowed to have side effects added with `addSideEffects`