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 protobufHistoryobject 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 WorkflowExecutionHistoryfromJson(java.lang.String serialized)static WorkflowExecutionHistoryfromJson(java.lang.String serialized, java.lang.String workflowId)java.util.List<io.temporal.api.history.v1.HistoryEvent>getEvents()io.temporal.api.history.v1.HistorygetHistory()io.temporal.api.history.v1.HistoryEventgetLastEvent()io.temporal.api.common.v1.WorkflowExecutiongetWorkflowExecution()java.lang.StringtoJson(boolean prettyPrint)java.lang.StringtoProtoText(boolean showWorkflowTasks)Returns workflow instance history in a human-readable format.java.lang.StringtoString()-
Methods inherited from class io.temporal.internal.common.WorkflowExecutionHistory
extractWorkflowId, toJson
-
-
-
-
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 (temporal CLI 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 (temporal CLI format) to import and deserialize intoHistoryworkflowId- workflow id to be used ingetWorkflowExecution()- Returns:
- WorkflowExecutionHistory
-
toJson
public java.lang.String toJson(boolean prettyPrint)
- Overrides:
toJsonin classWorkflowExecutionHistory- Parameters:
prettyPrint- Whether to pretty print the JSON.- Returns:
- Full json that can be used for replay.
-
toProtoText
public java.lang.String toProtoText(boolean showWorkflowTasks)
Returns workflow instance history in a human-readable format.- Overrides:
toProtoTextin 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:
getWorkflowExecutionin classWorkflowExecutionHistory
-
getEvents
public java.util.List<io.temporal.api.history.v1.HistoryEvent> getEvents()
- Overrides:
getEventsin classWorkflowExecutionHistory
-
getLastEvent
public io.temporal.api.history.v1.HistoryEvent getLastEvent()
- Overrides:
getLastEventin classWorkflowExecutionHistory
-
getHistory
public io.temporal.api.history.v1.History getHistory()
- Overrides:
getHistoryin classWorkflowExecutionHistory
-
toString
public java.lang.String toString()
- Overrides:
toStringin classWorkflowExecutionHistory
-
-