1

I'm working on a project that used Uber Cadence Java Client. How can I get the list of open/closed workflows from the code? I can get it from CLI but not from java code.

Thank you.

1 Answers1

0
WorkflowServiceTChannel cadenceService =
        new WorkflowServiceTChannel(ClientOptions.defaultInstance());

ListOpenWorkflowExecutionsRequest request = new ListOpenWorkflowExecutionsRequest();
request.setDomain(DOMAIN);
=request.set...;
ListOpenWorkflowExecutionsResponse resp = cadenceService.ListOpenWorkflowExecutions(request);

ListClosedWorkflowExecutionsRequest request = new ListClosedWorkflowExecutionsRequest();
request.setDomain(DOMAIN);
=request.set...;
ListClosedWorkflowExecutionsResponse resp = cadenceService.ListClosedWorkflowExecutions(request);


// If you have advanced visibility
ListWorkflowExecutionsRequest request = new ListWorkflowExecutionsRequest();
request.setDomain(DOMAIN);
=request.setQuery(...);
ListWorkflowExecutionsResponse resp = cadenceService.ListWorkflowExecutions(request);

See how the cadenceService is used in this sample

Documentation about advanced visibility

Long Quanzheng
  • 2,076
  • 1
  • 10
  • 22
  • Somehow this is not working for me, asking here: https://stackoverflow.com/questions/75393431/uber-cadence-unable-to-get-history-of-workflow-executions-via-java-client Using the same instance and code, which registers the workflow and a worker. – o_nix Feb 09 '23 at 01:53