public class WorkflowExecutionUtils
extends java.lang.Object
Constructor and Description |
---|
WorkflowExecutionUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsEvent(java.util.List<io.temporal.api.history.v1.HistoryEvent> history,
io.temporal.api.enums.v1.EventType eventType) |
static io.temporal.api.workflow.v1.WorkflowExecutionInfo |
describeWorkflowInstance(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
com.uber.m3.tally.Scope metricsScope) |
static io.temporal.api.enums.v1.WorkflowExecutionStatus |
getCloseStatus(io.temporal.api.history.v1.HistoryEvent event) |
static io.temporal.api.enums.v1.EventType |
getEventTypeForCommand(io.temporal.api.enums.v1.CommandType commandType)
Returns event that corresponds to a command.
|
static java.lang.String |
getFailureCause(io.temporal.api.history.v1.HistoryEvent historyEvent) |
static java.util.Iterator<io.temporal.api.history.v1.HistoryEvent> |
getHistory(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
com.uber.m3.tally.Scope metricsScope) |
static io.temporal.api.workflowservice.v1.GetWorkflowExecutionHistoryResponse |
getHistoryPage(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
com.google.protobuf.ByteString nextPageToken,
com.uber.m3.tally.Scope metricsScope) |
static java.lang.String |
getId(io.temporal.api.history.v1.HistoryEvent historyEvent) |
static io.temporal.api.history.v1.HistoryEvent |
getInstanceCloseEvent(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
com.uber.m3.tally.Scope metricsScope,
long timeout,
java.util.concurrent.TimeUnit unit)
Returns an instance closing event, potentially waiting for workflow to complete.
|
static java.util.Optional<io.temporal.api.common.v1.Payloads> |
getWorkflowExecutionResult(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
java.util.Optional<java.lang.String> workflowType,
com.uber.m3.tally.Scope metricsScope,
DataConverter converter,
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<java.util.Optional<io.temporal.api.common.v1.Payloads>> |
getWorkflowExecutionResultAsync(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
java.util.Optional<java.lang.String> workflowType,
long timeout,
java.util.concurrent.TimeUnit unit,
DataConverter converter) |
static io.temporal.api.common.v1.WorkflowExecution |
getWorkflowIdFromExternalWorkflowCompletedEvent(io.temporal.api.history.v1.HistoryEvent event) |
static boolean |
isActivityTaskClosedEvent(io.temporal.api.history.v1.HistoryEvent event) |
static boolean |
isCommandEvent(io.temporal.api.history.v1.HistoryEvent event)
Is this an event that was created to mirror a command?
|
static boolean |
isExternalWorkflowClosedEvent(io.temporal.api.history.v1.HistoryEvent event) |
static boolean |
isWorkflowExecutionCompleteCommand(io.temporal.api.command.v1.Command command) |
static boolean |
isWorkflowExecutionCompletedEvent(io.temporal.api.history.v1.HistoryEventOrBuilder event) |
static java.lang.String |
prettyPrintCommands(java.lang.Iterable<io.temporal.api.command.v1.Command> commands) |
static java.lang.String |
prettyPrintHistory(io.temporal.api.history.v1.History history,
boolean showWorkflowTasks)
Returns workflow instance history in a human readable format.
|
static java.lang.String |
prettyPrintHistory(java.util.Iterator<io.temporal.api.history.v1.HistoryEvent> events,
boolean showWorkflowTasks) |
static java.lang.String |
prettyPrintHistory(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
boolean showWorkflowTasks,
com.uber.m3.tally.Scope metricsScope)
Returns workflow instance history in a human readable format.
|
static java.lang.String |
prettyPrintHistory(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
com.uber.m3.tally.Scope metricsScope)
Returns workflow instance history in a human readable format.
|
static java.lang.String |
prettyPrintObject(com.google.protobuf.MessageOrBuilder object)
Pretty prints a proto message.
|
static WorkflowExecutionHistory |
readHistory(java.io.File historyFile) |
static WorkflowExecutionHistory |
readHistoryFromResource(java.lang.String resourceFileName) |
static io.temporal.api.enums.v1.WorkflowExecutionStatus |
waitForWorkflowInstanceCompletion(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
com.uber.m3.tally.Scope metricsScope)
Blocks until workflow instance completes.
|
static io.temporal.api.enums.v1.WorkflowExecutionStatus |
waitForWorkflowInstanceCompletion(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
com.uber.m3.tally.Scope metricsScope,
long timeout,
java.util.concurrent.TimeUnit unit)
Waits up to specified timeout for workflow instance completion.
|
static io.temporal.api.enums.v1.WorkflowExecutionStatus |
waitForWorkflowInstanceCompletionAcrossGenerations(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
com.uber.m3.tally.Scope metricsScope)
Like
waitForWorkflowInstanceCompletion(WorkflowServiceStubs, String, WorkflowExecution,
Scope, long, TimeUnit) , but with no timeout.* |
static io.temporal.api.enums.v1.WorkflowExecutionStatus |
waitForWorkflowInstanceCompletionAcrossGenerations(WorkflowServiceStubs service,
java.lang.String namespace,
io.temporal.api.common.v1.WorkflowExecution workflowExecution,
com.uber.m3.tally.Scope metricsScope,
long timeout,
java.util.concurrent.TimeUnit unit)
Like
waitForWorkflowInstanceCompletion(WorkflowServiceStubs, String, WorkflowExecution,
Scope, long, TimeUnit) , except will wait for continued generations of the original workflow
execution too. |
public static java.util.Optional<io.temporal.api.common.v1.Payloads> getWorkflowExecutionResult(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, java.util.Optional<java.lang.String> workflowType, com.uber.m3.tally.Scope metricsScope, DataConverter converter, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.TimeoutException
workflowType
- is optional.metricsScope
- metrics with NAMESPACE tag populatedjava.util.concurrent.TimeoutException
- if workflow didn't complete within specified timeoutCanceledFailure
- if workflow was canceledWorkflowExecutionFailedException
- if workflow execution failedpublic static java.util.concurrent.CompletableFuture<java.util.Optional<io.temporal.api.common.v1.Payloads>> getWorkflowExecutionResultAsync(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, java.util.Optional<java.lang.String> workflowType, long timeout, java.util.concurrent.TimeUnit unit, DataConverter converter)
public static io.temporal.api.history.v1.HistoryEvent getInstanceCloseEvent(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, com.uber.m3.tally.Scope metricsScope, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.TimeoutException
java.util.concurrent.TimeoutException
public static boolean isWorkflowExecutionCompletedEvent(io.temporal.api.history.v1.HistoryEventOrBuilder event)
public static boolean isWorkflowExecutionCompleteCommand(io.temporal.api.command.v1.Command command)
public static boolean isActivityTaskClosedEvent(io.temporal.api.history.v1.HistoryEvent event)
public static boolean isExternalWorkflowClosedEvent(io.temporal.api.history.v1.HistoryEvent event)
public static io.temporal.api.common.v1.WorkflowExecution getWorkflowIdFromExternalWorkflowCompletedEvent(io.temporal.api.history.v1.HistoryEvent event)
public static java.lang.String getId(io.temporal.api.history.v1.HistoryEvent historyEvent)
public static java.lang.String getFailureCause(io.temporal.api.history.v1.HistoryEvent historyEvent)
public static io.temporal.api.enums.v1.WorkflowExecutionStatus waitForWorkflowInstanceCompletion(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, com.uber.m3.tally.Scope metricsScope)
workflowExecution
- workflowId and optional runIdpublic static io.temporal.api.enums.v1.WorkflowExecutionStatus waitForWorkflowInstanceCompletion(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, com.uber.m3.tally.Scope metricsScope, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.TimeoutException
workflowExecution
- workflowId and optional runIdmetricsScope
- to use when reporting service callstimeout
- maximum time to wait for completion. 0 means wait forever.java.util.concurrent.TimeoutException
public static io.temporal.api.enums.v1.WorkflowExecutionStatus getCloseStatus(io.temporal.api.history.v1.HistoryEvent event)
public static io.temporal.api.enums.v1.WorkflowExecutionStatus waitForWorkflowInstanceCompletionAcrossGenerations(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, com.uber.m3.tally.Scope metricsScope, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.TimeoutException
waitForWorkflowInstanceCompletion(WorkflowServiceStubs, String, WorkflowExecution,
Scope, long, TimeUnit)
, except will wait for continued generations of the original workflow
execution too.java.util.concurrent.TimeoutException
waitForWorkflowInstanceCompletion(WorkflowServiceStubs, String, WorkflowExecution, Scope,
long, TimeUnit)
public static io.temporal.api.enums.v1.WorkflowExecutionStatus waitForWorkflowInstanceCompletionAcrossGenerations(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, com.uber.m3.tally.Scope metricsScope) throws java.lang.InterruptedException
waitForWorkflowInstanceCompletion(WorkflowServiceStubs, String, WorkflowExecution,
Scope, long, TimeUnit)
, but with no timeout.*java.lang.InterruptedException
public static io.temporal.api.workflow.v1.WorkflowExecutionInfo describeWorkflowInstance(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, com.uber.m3.tally.Scope metricsScope)
public static io.temporal.api.workflowservice.v1.GetWorkflowExecutionHistoryResponse getHistoryPage(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, com.google.protobuf.ByteString nextPageToken, com.uber.m3.tally.Scope metricsScope)
public static java.lang.String prettyPrintHistory(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, com.uber.m3.tally.Scope metricsScope)
public static java.lang.String prettyPrintHistory(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, boolean showWorkflowTasks, com.uber.m3.tally.Scope metricsScope)
showWorkflowTasks
- when set to false workflow task events (command events) are not
includedmetricsScope
- public static java.util.Iterator<io.temporal.api.history.v1.HistoryEvent> getHistory(WorkflowServiceStubs service, java.lang.String namespace, io.temporal.api.common.v1.WorkflowExecution workflowExecution, com.uber.m3.tally.Scope metricsScope)
public static java.lang.String prettyPrintHistory(io.temporal.api.history.v1.History history, boolean showWorkflowTasks)
showWorkflowTasks
- when set to false workflow task events (command events) are not
includedhistory
- Workflow instance historypublic static java.lang.String prettyPrintHistory(java.util.Iterator<io.temporal.api.history.v1.HistoryEvent> events, boolean showWorkflowTasks)
public static java.lang.String prettyPrintCommands(java.lang.Iterable<io.temporal.api.command.v1.Command> commands)
public static java.lang.String prettyPrintObject(com.google.protobuf.MessageOrBuilder object)
public static boolean containsEvent(java.util.List<io.temporal.api.history.v1.HistoryEvent> history, io.temporal.api.enums.v1.EventType eventType)
public static boolean isCommandEvent(io.temporal.api.history.v1.HistoryEvent event)
public static io.temporal.api.enums.v1.EventType getEventTypeForCommand(io.temporal.api.enums.v1.CommandType commandType)
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