Package io.temporal.common
Class WorkflowExecutionHistory
- java.lang.Object
-
- io.temporal.internal.common.WorkflowExecutionHistory
-
- io.temporal.common.WorkflowExecutionHistory
-
public final class WorkflowExecutionHistory extends WorkflowExecutionHistory
Provides a wrapper with convenience methods over raw protobufHistory
object representing workflow history
-
-
Field Summary
-
Fields inherited from class io.temporal.internal.common.WorkflowExecutionHistory
DEFAULT_WORKFLOW_ID
-
-
Constructor Summary
Constructors Constructor Description WorkflowExecutionHistory(io.temporal.api.history.v1.History history)
WorkflowExecutionHistory(io.temporal.api.history.v1.History history, java.lang.String workflowId)
WorkflowId is not persisted in workflow history, and sometimes it may be important to have it set (workflow replay may rely on it if WorkflowExecutionHistory is used for a history replay)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WorkflowExecutionHistory
fromJson(java.lang.String serialized)
static WorkflowExecutionHistory
fromJson(java.lang.String serialized, java.lang.String workflowId)
java.util.List<io.temporal.api.history.v1.HistoryEvent>
getEvents()
io.temporal.api.history.v1.History
getHistory()
io.temporal.api.history.v1.HistoryEvent
getLastEvent()
io.temporal.api.common.v1.WorkflowExecution
getWorkflowExecution()
java.lang.String
toJson(boolean prettyPrint)
java.lang.String
toProtoText(boolean showWorkflowTasks)
Returns workflow instance history in a human-readable format.java.lang.String
toString()
-
-
-
Constructor Detail
-
WorkflowExecutionHistory
public WorkflowExecutionHistory(io.temporal.api.history.v1.History history)
- Parameters:
history
- raw history object to enrich
-
WorkflowExecutionHistory
public WorkflowExecutionHistory(io.temporal.api.history.v1.History history, java.lang.String workflowId)
WorkflowId is not persisted in workflow history, and sometimes it may be important to have it set (workflow replay may rely on it if WorkflowExecutionHistory is used for a history replay)- Parameters:
history
- raw history object to enrichworkflowId
- workflow id to be used ingetWorkflowExecution()
-
-
Method Detail
-
fromJson
public static WorkflowExecutionHistory fromJson(java.lang.String serialized)
- Parameters:
serialized
- history json (tctl format) to import and deserialize intoHistory
- Returns:
- WorkflowExecutionHistory
-
fromJson
public static WorkflowExecutionHistory fromJson(java.lang.String serialized, java.lang.String workflowId)
- Parameters:
serialized
- history json (tctl format) to import and deserialize intoHistory
workflowId
- workflow id to be used ingetWorkflowExecution()
- Returns:
- WorkflowExecutionHistory
-
toJson
public java.lang.String toJson(boolean prettyPrint)
- Overrides:
toJson
in classWorkflowExecutionHistory
- Returns:
- full json that can be used for replay and which is compatible with tctl
-
toProtoText
public java.lang.String toProtoText(boolean showWorkflowTasks)
Returns workflow instance history in a human-readable format.- Overrides:
toProtoText
in classWorkflowExecutionHistory
- Parameters:
showWorkflowTasks
- when set to false workflow task events (command events) are not included
-
getWorkflowExecution
public io.temporal.api.common.v1.WorkflowExecution getWorkflowExecution()
- Overrides:
getWorkflowExecution
in classWorkflowExecutionHistory
-
getEvents
public java.util.List<io.temporal.api.history.v1.HistoryEvent> getEvents()
- Overrides:
getEvents
in classWorkflowExecutionHistory
-
getLastEvent
public io.temporal.api.history.v1.HistoryEvent getLastEvent()
- Overrides:
getLastEvent
in classWorkflowExecutionHistory
-
getHistory
public io.temporal.api.history.v1.History getHistory()
- Overrides:
getHistory
in classWorkflowExecutionHistory
-
toString
public java.lang.String toString()
- Overrides:
toString
in classWorkflowExecutionHistory
-
-