public class WorkflowExecutionUtils
extends java.lang.Object
Constructor and Description |
---|
WorkflowExecutionUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsEvent(java.util.List<HistoryEvent> history,
EventType eventType) |
static WorkflowExecutionInfo |
describeWorkflowInstance(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution) |
static WorkflowExecutionCloseStatus |
getCloseStatus(HistoryEvent event) |
static EventType |
getEventTypeForDecision(DecisionType decisionType) |
static java.lang.String |
getFailureCause(HistoryEvent historyEvent) |
static java.util.Iterator<HistoryEvent> |
getHistory(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution) |
static GetWorkflowExecutionHistoryResponse |
getHistoryPage(byte[] nextPageToken,
IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution) |
static java.lang.String |
getId(HistoryEvent historyEvent) |
static byte[] |
getWorkflowExecutionResult(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution,
java.util.Optional<java.lang.String> workflowType,
long timeout,
java.util.concurrent.TimeUnit unit)
Returns result of a workflow instance execution or throws an exception if workflow did not
complete successfully.
|
static java.util.concurrent.CompletableFuture<byte[]> |
getWorkflowExecutionResultAsync(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution,
java.util.Optional<java.lang.String> workflowType,
long timeout,
java.util.concurrent.TimeUnit unit) |
static WorkflowExecution |
getWorkflowIdFromExternalWorkflowCompletedEvent(HistoryEvent event) |
static boolean |
isActivityTaskClosedEvent(HistoryEvent event) |
static boolean |
isDecisionEvent(HistoryEvent event)
Is this an event that was created to mirror a decision?
|
static boolean |
isExternalWorkflowClosedEvent(HistoryEvent event) |
static boolean |
isWorkflowExecutionCompleteDecision(Decision decision) |
static boolean |
isWorkflowExecutionCompletedEvent(HistoryEvent event) |
static java.lang.String |
prettyPrintDecision(Decision decision)
Returns single decision in a human readable format
|
static java.lang.String |
prettyPrintDecisions(java.lang.Iterable<Decision> decisions) |
static java.lang.String |
prettyPrintHistory(History history,
boolean showWorkflowTasks)
Returns workflow instance history in a human readable format.
|
static java.lang.String |
prettyPrintHistory(java.util.Iterator<HistoryEvent> events,
boolean showWorkflowTasks) |
static java.lang.String |
prettyPrintHistory(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution)
Returns workflow instance history in a human readable format.
|
static java.lang.String |
prettyPrintHistory(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution,
boolean showWorkflowTasks)
Returns workflow instance history in a human readable format.
|
static java.lang.String |
prettyPrintHistoryEvent(HistoryEvent event)
Returns single event in a human readable format
|
static WorkflowExecutionHistory |
readHistory(java.io.File historyFile) |
static WorkflowExecutionHistory |
readHistoryFromResource(java.lang.String resourceFileName) |
static WorkflowExecutionCloseStatus |
waitForWorkflowInstanceCompletion(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution)
Blocks until workflow instance completes.
|
static WorkflowExecutionCloseStatus |
waitForWorkflowInstanceCompletion(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution,
long timeout,
java.util.concurrent.TimeUnit unit)
Waits up to specified timeout for workflow instance completion.
|
static WorkflowExecutionCloseStatus |
waitForWorkflowInstanceCompletionAcrossGenerations(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution)
Like
waitForWorkflowInstanceCompletion(IWorkflowService, String, WorkflowExecution,
long, TimeUnit) , but with no timeout.* |
static WorkflowExecutionCloseStatus |
waitForWorkflowInstanceCompletionAcrossGenerations(IWorkflowService service,
java.lang.String domain,
WorkflowExecution workflowExecution,
long timeout,
java.util.concurrent.TimeUnit unit)
Like
waitForWorkflowInstanceCompletion(IWorkflowService, String, WorkflowExecution,
long, TimeUnit) , except will wait for continued generations of the original workflow
execution too. |
public static byte[] getWorkflowExecutionResult(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution, java.util.Optional<java.lang.String> workflowType, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.TimeoutException, java.util.concurrent.CancellationException, WorkflowExecutionFailedException, WorkflowTerminatedException, WorkflowTimedOutException, EntityNotExistsError
workflowType
- is optional.java.util.concurrent.TimeoutException
- if workflow didn't complete within specified timeoutjava.util.concurrent.CancellationException
- if workflow was cancelledWorkflowExecutionFailedException
- if workflow execution failedWorkflowTimedOutException
- if workflow execution exceeded its execution timeout and was
forcefully terminated by the Cadence server.WorkflowTerminatedException
- if workflow execution was terminated through an external
terminate command.EntityNotExistsError
public static java.util.concurrent.CompletableFuture<byte[]> getWorkflowExecutionResultAsync(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution, java.util.Optional<java.lang.String> workflowType, long timeout, java.util.concurrent.TimeUnit unit)
public static boolean isWorkflowExecutionCompletedEvent(HistoryEvent event)
public static boolean isWorkflowExecutionCompleteDecision(Decision decision)
public static boolean isActivityTaskClosedEvent(HistoryEvent event)
public static boolean isExternalWorkflowClosedEvent(HistoryEvent event)
public static WorkflowExecution getWorkflowIdFromExternalWorkflowCompletedEvent(HistoryEvent event)
public static java.lang.String getId(HistoryEvent historyEvent)
public static java.lang.String getFailureCause(HistoryEvent historyEvent)
public static WorkflowExecutionCloseStatus waitForWorkflowInstanceCompletion(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution) throws EntityNotExistsError
workflowExecution
- result of WorkflowService.Iface.StartWorkflowExecution(StartWorkflowExecutionRequest)
EntityNotExistsError
public static WorkflowExecutionCloseStatus waitForWorkflowInstanceCompletion(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.TimeoutException, EntityNotExistsError
workflowExecution
- result of WorkflowService.Iface.StartWorkflowExecution(StartWorkflowExecutionRequest)
timeout
- maximum time to wait for completion. 0 means wait forever.java.util.concurrent.TimeoutException
EntityNotExistsError
public static WorkflowExecutionCloseStatus getCloseStatus(HistoryEvent event)
public static WorkflowExecutionCloseStatus waitForWorkflowInstanceCompletionAcrossGenerations(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.TimeoutException, EntityNotExistsError
waitForWorkflowInstanceCompletion(IWorkflowService, String, WorkflowExecution,
long, TimeUnit)
, except will wait for continued generations of the original workflow
execution too.java.util.concurrent.TimeoutException
EntityNotExistsError
waitForWorkflowInstanceCompletion(IWorkflowService, String, WorkflowExecution, long,
TimeUnit)
public static WorkflowExecutionCloseStatus waitForWorkflowInstanceCompletionAcrossGenerations(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution) throws java.lang.InterruptedException, EntityNotExistsError
waitForWorkflowInstanceCompletion(IWorkflowService, String, WorkflowExecution,
long, TimeUnit)
, but with no timeout.*java.lang.InterruptedException
EntityNotExistsError
public static WorkflowExecutionInfo describeWorkflowInstance(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution)
public static GetWorkflowExecutionHistoryResponse getHistoryPage(byte[] nextPageToken, IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution)
public static java.lang.String prettyPrintHistory(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution)
public static java.lang.String prettyPrintHistory(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution, boolean showWorkflowTasks)
showWorkflowTasks
- when set to false workflow task events (decider events) are not
includedpublic static java.util.Iterator<HistoryEvent> getHistory(IWorkflowService service, java.lang.String domain, WorkflowExecution workflowExecution)
public static java.lang.String prettyPrintHistory(History history, boolean showWorkflowTasks)
showWorkflowTasks
- when set to false workflow task events (decider events) are not
includedhistory
- Workflow instance historypublic static java.lang.String prettyPrintHistory(java.util.Iterator<HistoryEvent> events, boolean showWorkflowTasks)
public static java.lang.String prettyPrintDecisions(java.lang.Iterable<Decision> decisions)
public static java.lang.String prettyPrintHistoryEvent(HistoryEvent event)
event
- event to pretty printpublic static java.lang.String prettyPrintDecision(Decision decision)
decision
- decision to pretty printpublic static boolean containsEvent(java.util.List<HistoryEvent> history, EventType eventType)
public static boolean isDecisionEvent(HistoryEvent event)
public static EventType getEventTypeForDecision(DecisionType decisionType)
public static WorkflowExecutionHistory readHistoryFromResource(java.lang.String resourceFileName) throws java.io.IOException
java.io.IOException
public static WorkflowExecutionHistory readHistory(java.io.File historyFile) throws java.io.IOException
java.io.IOException