WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
GetWorkflowExecutionHistoryResponse result =
service
.blockingStub()
.getWorkflowExecutionHistory(
GetWorkflowExecutionHistoryRequest.newBuilder()
.setNamespace(namespace)
.setExecution(WorkflowExecution.newBuilder().setWorkflowId(workflowId).build())
.build());
Note that history can contain multiple pages. So you might need to call this API a few times using a page token.