Skip to content

Instantly share code, notes, and snippets.

@tsurdilo
Created May 3, 2021 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsurdilo/5664348b459ffa1ce1635925462594d7 to your computer and use it in GitHub Desktop.
Save tsurdilo/5664348b459ffa1ce1635925462594d7 to your computer and use it in GitHub Desktop.
Util method to get workflow execution status
public static WorkflowExecutionStatus getWorkflowExcutionStatus(String workflowID, String namespace) {
WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
WorkflowServiceGrpc.WorkflowServiceBlockingStub stub = service.blockingStub();
DescribeWorkflowExecutionRequest request =
DescribeWorkflowExecutionRequest.newBuilder()
.setNamespace(namespace)
.setExecution(
WorkflowExecution.newBuilder().setWorkflowId(workflowID)
// .setRunId(runId)) // Note you can also pass run id
)
.build();
DescribeWorkflowExecutionResponse response = stub.describeWorkflowExecution(request);
if (response.hasWorkflowExecutionInfo()) {
return response.getWorkflowExecutionInfo().getStatus();
} else {
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment