Wotkflow execution history list and features using java sdk

I would like to know if there’s any example to get workflow Ids, Run Ids list from the required namespace using JAVA SDK, and also if there is any way we can export workflow history using Java SDK. It would be of much help if that can be shared

  1. You can use ListWorkflowExecutionsRequest, sample here: samples-java/src/main/java/io/temporal/samples/listworkflows at master · temporalio/samples-java · GitHub
    note the readme as you have to enable ES on the server for this to work.

  2. You can get the history (in JSON format) via GetWorkflowExecutionHistoryRequest, for example:

GetWorkflowExecutionHistoryRequest request =
          GetWorkflowExecutionHistoryRequest.newBuilder()
              .setNamespace("default")
              .setExecution(execution)
              .build();
      GetWorkflowExecutionHistoryResponse result =
          service.blockingStub().getWorkflowExecutionHistory(request);
      String jsonHistory = JsonFormat.printer().print(result.getHistory());

for large histories this can become memory intensive, so using tctl or web-ui to get the history would probably make more sense.

Thank you this helps

  1. You can use ListWorkflowExecutionsRequest, sample here: samples-java/src/main/java/io/temporal/samples/listworkflows at master · temporalio/samples-java · GitHub
    note the readme as you have to enable ES on the server for this to work.

Can this be done without using ES ?
I wanted something similar to temporal web getting the list of workflows.

You can use
ListOpenWorkflowExecutions
and
ListClosedWorkflowExecutions
APIs which are supported without the need for ES

1 Like