Interface WorkflowClient


@DoNotInherit public interface WorkflowClient
Not for user extension
  • Method Details

    • method

      <T, R> ComponentMethodRef<R> method(akka.japi.function.Function<T,Workflow.Effect<R>> methodRef)
      Pass in a Workflow command handler method reference, e.g. MyWorkflow::start
    • method

      <T, A1, R> ComponentMethodRef1<A1,R> method(akka.japi.function.Function2<T,A1,Workflow.Effect<R>> methodRef)
      Pass in a Workflow command handler method reference, e.g. MyWorkflow::start
    • notificationStream

      <T, R> ComponentStreamMethodRef<R> notificationStream(akka.japi.function.Function<T,NotificationPublisher.NotificationStream<R>> methodRef)
      Pass in a Workflow notification stream getter method reference, e.g. MyWorkflow::updates
    • terminate

      akka.Done terminate(Class<? extends Workflow<?>> workflowClass)
      Terminate the workflow identified by this client's workflow id. Termination stops the workflow immediately (including any in-flight step), cancels pause/step/workflow-timeout timers, and moves the workflow into a terminal Terminated state from which no further transitions are possible. The call is idempotent — terminating an already-finished workflow is a no-op.
      Parameters:
      workflowClass - the Workflow class, used to resolve the component id the runtime needs to route the termination command.
    • terminateAsync

      CompletionStage<akka.Done> terminateAsync(Class<? extends Workflow<?>> workflowClass)
      Async variant of terminate(Class).
    • terminate

      akka.Done terminate(Class<? extends Workflow<?>> workflowClass, String reason)
      Terminate the workflow identified by this client's workflow id, recording a free-form reason. An empty reason is equivalent to terminate(Class).

      The reason is short, human-readable text — same guidance as the paused-workflow reason. It is persisted in the workflow's event journal and written to runtime logs at termination time, so it MUST NOT contain secrets or PII.

      On a workflow that is already in a terminal state, the call is a successful no-op and the previously-recorded reason (if any) is not overwritten.

      Parameters:
      workflowClass - the Workflow class, used to resolve the component id.
      reason - free-form reason. Must not be null.
    • terminateAsync

      CompletionStage<akka.Done> terminateAsync(Class<? extends Workflow<?>> workflowClass, String reason)
      Async variant of terminate(Class, String).
    • suspend

      akka.Done suspend(Class<? extends Workflow<?>> workflowClass)
      Suspend the workflow identified by this client's workflow id. Suspension behaves like termination in that the workflow does not wait for an in-flight step to complete: any result it produces after the suspend takes effect is ignored. On resume(Class), execution restarts at the step that was in flight, giving it a fresh chance to run. The call is idempotent — suspending an already-suspended workflow is a no-op.

      Timeouts remain active while a workflow is suspended:

      • If a workflow timeout fires while suspended, the workflow fails with a timeout.
      • If a workflow timeout with a failover step fires while suspended, the failover step is executed on resume.
      • If a pause timer fires while suspended, the configured timeout handler is called on resume.

      While suspended, the workflow is passivated and does not consume any runtime resources.

      Parameters:
      workflowClass - the Workflow class, used to resolve the component id the runtime needs to route the suspend command.
    • suspendAsync

      CompletionStage<akka.Done> suspendAsync(Class<? extends Workflow<?>> workflowClass)
      Async variant of suspend(Class).
    • suspend

      akka.Done suspend(Class<? extends Workflow<?>> workflowClass, String reason)
      Suspend the workflow identified by this client's workflow id, recording a free-form reason. An empty reason is equivalent to suspend(Class).

      The reason is short, human-readable text — same guidance as the paused-workflow reason. It is persisted in the workflow's event journal and written to runtime logs at suspend time, so it MUST NOT contain secrets or PII.

      On a workflow that is already suspended, the call is a successful no-op and the previously-recorded reason (if any) is not overwritten.

      Parameters:
      workflowClass - the Workflow class, used to resolve the component id.
      reason - free-form reason. Must not be null.
    • suspendAsync

      CompletionStage<akka.Done> suspendAsync(Class<? extends Workflow<?>> workflowClass, String reason)
      Async variant of suspend(Class, String).
    • resume

      akka.Done resume(Class<? extends Workflow<?>> workflowClass)
      Resume the workflow identified by this client's workflow id. Resumption is only meaningful against a workflow currently in the Suspended state — execution restarts at the step that was in flight at suspend time, giving it a fresh chance to run. If a workflow timeout with a failover step fired while suspended, the failover step is executed on resume; if a pause timer fired while suspended, the configured timeout handler is called on resume. The call is idempotent on a non-suspended workflow: it is a successful no-op.
      Parameters:
      workflowClass - the Workflow class, used to resolve the component id the runtime needs to route the resume command.
    • resumeAsync

      CompletionStage<akka.Done> resumeAsync(Class<? extends Workflow<?>> workflowClass)
      Async variant of resume(Class).