Created
May 3, 2021 15:58
-
-
Save tsurdilo/5664348b459ffa1ce1635925462594d7 to your computer and use it in GitHub Desktop.
Util method to get workflow execution status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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