mwat
1
Hello,
Is there any way to retrieve the cron schedule for a running workflow using the Java SDK?
The cron schedule is available using the REST API (http://localhost:8088/api/namespaces/default/workflows/<WF_ID>/<RF_ID>/history?waitForNewEvent=true), but I cannot see a way to retrieve it using the Java SDK.
Any help or advice would be much appreciated.
Many thanks
tihomir
2
Currently you have to load the first event from history. You can use GetWorkflowExecutionHistoryRequest, for example:
GetWorkflowExecutionHistoryRequest request =
GetWorkflowExecutionHistoryRequest.newBuilder()
.setNamespace("default")
.setExecution(execution)
.setMaximumPageSize(1)
.build();
GetWorkflowExecutionHistoryResponse result =
service.blockingStub().getWorkflowExecutionHistory(request);
List<HistoryEvent> events = result.getHistory().getEventsList();
String cronSchedule =
events.get(0).getWorkflowExecutionStartedEventAttributes().getCronSchedule();
tihomir
4
Added
.setMaximumPageSize(1) (updated code in the last post) as optimization.