Package io.dapr.durabletask
Class OrchestrationRunner
java.lang.Object
io.dapr.durabletask.OrchestrationRunner
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 TypeMethodDescriptionstatic <R> byte[]loadAndRun(byte[] orchestratorRequestBytes, OrchestratorFunction<R> orchestratorFunc) Loads orchestration history fromorchestratorRequestBytesand uses it to execute the orchestrator function code pointed to byorchestratorFunc.static byte[]loadAndRun(byte[] orchestratorRequestBytes, TaskOrchestration orchestration) Loads orchestration history fromorchestratorRequestBytesand uses it to execute theorchestration.static <R> StringloadAndRun(String base64EncodedOrchestratorRequest, OrchestratorFunction<R> orchestratorFunc) Loads orchestration history frombase64EncodedOrchestratorRequestand uses it to execute the orchestrator function code pointed to byorchestratorFunc.static StringloadAndRun(String base64EncodedOrchestratorRequest, TaskOrchestration orchestration) Loads orchestration history frombase64EncodedOrchestratorRequestand uses it to execute theorchestration.
-
Method Details
-
loadAndRun
public static <R> String loadAndRun(String base64EncodedOrchestratorRequest, OrchestratorFunction<R> orchestratorFunc) Loads orchestration history frombase64EncodedOrchestratorRequestand uses it to execute the orchestrator function code pointed to byorchestratorFunc.- 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 requestorchestratorFunc- 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 isnullor ifbase64EncodedOrchestratorRequestis not valid base64-encoded protobuf
-
loadAndRun
public static <R> byte[] loadAndRun(byte[] orchestratorRequestBytes, OrchestratorFunction<R> orchestratorFunc) Loads orchestration history fromorchestratorRequestBytesand uses it to execute the orchestrator function code pointed to byorchestratorFunc.- 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 requestorchestratorFunc- 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 isnullor iforchestratorRequestBytesis not valid protobuf
-
loadAndRun
public static String loadAndRun(String base64EncodedOrchestratorRequest, TaskOrchestration orchestration) Loads orchestration history frombase64EncodedOrchestratorRequestand uses it to execute theorchestration.- Parameters:
base64EncodedOrchestratorRequest- the base64-encoded protobuf payload representing an orchestrator execution requestorchestration- 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 isnullor ifbase64EncodedOrchestratorRequestis not valid base64-encoded protobuf
-
loadAndRun
Loads orchestration history fromorchestratorRequestBytesand uses it to execute theorchestration.- Parameters:
orchestratorRequestBytes- the protobuf payload representing an orchestrator execution requestorchestration- 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 isnullor iforchestratorRequestBytesis not valid protobuf
-