Interface AbstractWorkflow.Effect.Builder<S>

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

public static interface AbstractWorkflow.Effect.Builder<S>
Construct the effect that is returned by the command handler or a step transition.

The effect describes next processing actions, such as updating state, transition to another step and sending a reply.

  • Method Details

    • updateState

      @ApiMayChange AbstractWorkflow.Effect.PersistenceEffectBuilder<S> updateState(S newState)
    • pause

      Pause the workflow execution and wait for an external input, e.g. via command handler.
    • transitionTo

      @ApiMayChange <I> AbstractWorkflow.Effect.TransitionalEffect<Void> transitionTo(String stepName, I input)
      Defines the next step to which the workflow should transition to.

      The step definition identified by stepName must have an input parameter of type I. In other words, the next step call (or asyncCall) must have been defined with a Function that accepts an input parameter of type I.

      Parameters:
      stepName - The step name that should be executed next.
      input - The input param for the next step.
    • transitionTo

      @ApiMayChange AbstractWorkflow.Effect.TransitionalEffect<Void> transitionTo(String stepName)
      Defines the next step to which the workflow should transition to.

      The step definition identified by stepName must not have an input parameter. In other words, the next step call (or asyncCall) must have been defined with a Supplier function.

      Parameters:
      stepName - The step name that should be executed next.
    • end

      Finish the workflow execution. After transition to end, no more transitions are allowed.
    • reply

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

      <R> AbstractWorkflow.Effect<R> reply(R message, Metadata metadata)
      Reply after for example updateState.
      Type Parameters:
      R - 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.
    • error

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

      <R> AbstractWorkflow.Effect.ErrorEffect<R> error(String description, io.grpc.Status.Code statusCode)
      Create an error reply with a gRPC status code.
      Type Parameters:
      R - The type of the message that must be returned by this call.
      Parameters:
      description - The description of the error.
      statusCode - A custom gRPC status code.
      Returns:
      An error reply.
    • error

      <R> AbstractWorkflow.Effect.ErrorEffect<R> error(String description, StatusCode.ErrorCode httpErrorCode)
      Create an error reply with an HTTP status code.
      Type Parameters:
      R - 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.