Class OrchestrationRunner

java.lang.Object
io.dapr.durabletask.OrchestrationRunner

public final class OrchestrationRunner extends Object
Helper class for invoking orchestrations directly, without constructing a DurableTaskGrpcWorker object.

This static class can be used to execute orchestration logic directly. In order to use it for this purpose, the caller must provide orchestration state as serialized protobuf bytes.

  • Method Summary

    Modifier and Type
    Method
    Description
    static <R> byte[]
    loadAndRun(byte[] orchestratorRequestBytes, OrchestratorFunction<R> orchestratorFunc)
    Loads orchestration history from orchestratorRequestBytes and uses it to execute the orchestrator function code pointed to by orchestratorFunc.
    static byte[]
    loadAndRun(byte[] orchestratorRequestBytes, TaskOrchestration orchestration)
    Loads orchestration history from orchestratorRequestBytes and uses it to execute the orchestration.
    static <R> String
    loadAndRun(String base64EncodedOrchestratorRequest, OrchestratorFunction<R> orchestratorFunc)
    Loads orchestration history from base64EncodedOrchestratorRequest and uses it to execute the orchestrator function code pointed to by orchestratorFunc.
    static String
    loadAndRun(String base64EncodedOrchestratorRequest, TaskOrchestration orchestration)
    Loads orchestration history from base64EncodedOrchestratorRequest and uses it to execute the orchestration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • loadAndRun

      public static <R> String loadAndRun(String base64EncodedOrchestratorRequest, OrchestratorFunction<R> orchestratorFunc)
      Loads orchestration history from base64EncodedOrchestratorRequest and uses it to execute the orchestrator function code pointed to by orchestratorFunc.
      Type Parameters:
      R - the type of the orchestrator function output, which must be serializable to JSON
      Parameters:
      base64EncodedOrchestratorRequest - the base64-encoded protobuf payload representing an orchestrator execution request
      orchestratorFunc - a function that implements the orchestrator logic
      Returns:
      a base64-encoded protobuf payload of orchestrator actions to be interpreted by the external orchestration engine
      Throws:
      IllegalArgumentException - if either parameter is null or if base64EncodedOrchestratorRequest is not valid base64-encoded protobuf
    • loadAndRun

      public static <R> byte[] loadAndRun(byte[] orchestratorRequestBytes, OrchestratorFunction<R> orchestratorFunc)
      Loads orchestration history from orchestratorRequestBytes and uses it to execute the orchestrator function code pointed to by orchestratorFunc.
      Type Parameters:
      R - the type of the orchestrator function output, which must be serializable to JSON
      Parameters:
      orchestratorRequestBytes - the protobuf payload representing an orchestrator execution request
      orchestratorFunc - a function that implements the orchestrator logic
      Returns:
      a protobuf-encoded payload of orchestrator actions to be interpreted by the external orchestration engine
      Throws:
      IllegalArgumentException - if either parameter is null or if orchestratorRequestBytes is not valid protobuf
    • loadAndRun

      public static String loadAndRun(String base64EncodedOrchestratorRequest, TaskOrchestration orchestration)
      Loads orchestration history from base64EncodedOrchestratorRequest and uses it to execute the orchestration.
      Parameters:
      base64EncodedOrchestratorRequest - the base64-encoded protobuf payload representing an orchestrator execution request
      orchestration - the orchestration to execute
      Returns:
      a base64-encoded protobuf payload of orchestrator actions to be interpreted by the external orchestration engine
      Throws:
      IllegalArgumentException - if either parameter is null or if base64EncodedOrchestratorRequest is not valid base64-encoded protobuf
    • loadAndRun

      public static byte[] loadAndRun(byte[] orchestratorRequestBytes, TaskOrchestration orchestration)
      Loads orchestration history from orchestratorRequestBytes and uses it to execute the orchestration.
      Parameters:
      orchestratorRequestBytes - the protobuf payload representing an orchestrator execution request
      orchestration - the orchestration to execute
      Returns:
      a protobuf-encoded payload of orchestrator actions to be interpreted by the external orchestration engine
      Throws:
      IllegalArgumentException - if either parameter is null or if orchestratorRequestBytes is not valid protobuf