Hi, in Temporal UI, there’s a history tab that shows a lot of workflow execution details in json format.
How do I access these details using the java-sdk. Is there a method that I can call to get all these details?
Thanks!
WorkflowServiceStubs service = WorkflowServiceStubs.newServiceStubs(stubOptions);
service.blockingStub().getWorkflowExecutionHistory(...);
Note, in newer versions of the SDK we have high level wrappers for this now. See WorkflowClient.fetchHistory and even the more advanced WorkflowClient.streamHistory. WorkflowClient.listExecutions + these are often used to build tooling to run the replayer.
I tried that one, and also this:
GetWorkflowExecutionHistoryRequest request =
GetWorkflowExecutionHistoryRequest.newBuilder()
.setNamespace(NAMESPACE)
.setExecution(workflowExecution)
.build()
GetWorkflowExecutionHistoryResponse result =
service.blockingStub().getWorkflowExecutionHistory(request)
String jsonHistory = JsonFormat.printer().print(result.getHistory())
But when I compare it to Temporal UI history tab, I’m not getting some of the fields there. Is the one in UI has a custom formatting?
Their format is different I believe, what fields are you missing and from which side?
Would use the json you get from WorkflowExecutionHistory as “source of truth” as well as use it in WorkflowReplayer.