Package io.dapr.workflows.client
Class WorkflowInstanceStatus
java.lang.Object
io.dapr.workflows.client.WorkflowInstanceStatus
Represents a snapshot of a workflow instance's current state, including
metadata.
-
Constructor Summary
ConstructorDescriptionWorkflowInstanceStatus
(com.microsoft.durabletask.OrchestrationMetadata orchestrationMetadata) Class constructor. -
Method Summary
Modifier and TypeMethodDescriptionGets the workflow instance's creation time in UTC.Gets the failure details, if any, for the failed workflow instance.Gets the unique ID of the workflow instance.Gets the workflow instance's last updated time in UTC.getName()
Gets the name of the workflow.Gets the current runtime status of the workflow instance at the time this object was fetched.Gets the workflow instance's serialized input, if any, as a string value.Gets the workflow instance's serialized output, if any, as a string value.boolean
Gets a value indicating whether the workflow instance was completed at the time this object was fetched.boolean
Gets a value indicating whether the workflow instance was running at the time this object was fetched.<T> T
readInputAs
(Class<T> type) Deserializes the workflow's input into an object of the specified type.<T> T
readOutputAs
(Class<T> type) Deserializes the workflow's output into an object of the specified type.toString()
Generates a user-friendly string representation of the current metadata object.
-
Constructor Details
-
WorkflowInstanceStatus
public WorkflowInstanceStatus(com.microsoft.durabletask.OrchestrationMetadata orchestrationMetadata) Class constructor.- Parameters:
orchestrationMetadata
- Durable task orchestration metadata
-
-
Method Details
-
getName
Gets the name of the workflow.- Returns:
- the name of the workflow
-
getInstanceId
Gets the unique ID of the workflow instance.- Returns:
- the unique ID of the workflow instance
-
getRuntimeStatus
Gets the current runtime status of the workflow instance at the time this object was fetched.- Returns:
- the current runtime status of the workflow instance at the time this object was fetched
-
getCreatedAt
Gets the workflow instance's creation time in UTC.- Returns:
- the workflow instance's creation time in UTC
-
getLastUpdatedAt
Gets the workflow instance's last updated time in UTC.- Returns:
- the workflow instance's last updated time in UTC
-
getSerializedInput
Gets the workflow instance's serialized input, if any, as a string value.- Returns:
- the workflow instance's serialized input or
null
-
getSerializedOutput
Gets the workflow instance's serialized output, if any, as a string value.- Returns:
- the workflow instance's serialized output or
null
-
getFailureDetails
Gets the failure details, if any, for the failed workflow instance.This method returns data only if the workflow is in the
OrchestrationRuntimeStatus.FAILED
state, and only if this instance metadata was fetched with the option to include output data.- Returns:
- the failure details of the failed workflow instance or
null
-
isRunning
public boolean isRunning()Gets a value indicating whether the workflow instance was running at the time this object was fetched.- Returns:
true
if the workflow existed and was in a running state otherwisefalse
-
isCompleted
public boolean isCompleted()Gets a value indicating whether the workflow instance was completed at the time this object was fetched.A workflow instance is considered completed when its runtime status value is
WorkflowRuntimeStatus.COMPLETED
,WorkflowRuntimeStatus.FAILED
, orWorkflowRuntimeStatus.TERMINATED
.- Returns:
true
if the workflow was in a terminal state; otherwisefalse
-
readInputAs
Deserializes the workflow's input into an object of the specified type.Deserialization is performed using the DataConverter that was configured on the DurableTaskClient object that created this workflow metadata object.
- Type Parameters:
T
- the type to deserialize the input data into- Parameters:
type
- the class associated with the type to deserialize the input data into- Returns:
- the deserialized input value
- Throws:
IllegalStateException
- if the metadata was fetched without the option to read inputs and outputs
-
readOutputAs
Deserializes the workflow's output into an object of the specified type.Deserialization is performed using the DataConverter that was configured on the DurableTaskClient object that created this workflow metadata object.
- Type Parameters:
T
- the type to deserialize the output data into- Parameters:
type
- the class associated with the type to deserialize the output data into- Returns:
- the deserialized input value
- Throws:
IllegalStateException
- if the metadata was fetched without the option to read inputs and outputs
-
toString
Generates a user-friendly string representation of the current metadata object.
-