[Java] How to get existing workflow options from a workflow stub?

How can I retrieve an existing WorkflowOptions from a WorkflowStub? I want to terminate a cron and reschedule it with new options, if the options have changed.

Which config options do you need to get from the client side?

from workflow stub you can get a limited set of info such as workflow id and run id.

You can get additional info from DescribeWorkflowExecution api, for example:

DescribeWorkflowExecutionRequest req =
DescribeWorkflowExecutionResponse res =

Another approach could be to get the first event in history (WorkflowExecutionStarted event) and get its started event attributes, for example:

GetWorkflowExecutionHistoryRequest req = GetWorkflowExecutionHistoryRequest.newBuilder()
GetWorkflowExecutionHistoryResponse res =

HistoryEvent firstEvent = res.getHistory().getEvents(0);

// ...

Thank you @tihomir. Is there anyway to fetch the existing cronSchedule from DescribeWorkflowExecutionResponse? I’m not seeing it.

I do wish this was a little bit easier from an API perspective. It seems like a common use case to conditionally reschedule a cron only if the options have changed.

from DescribeWorkflowExecutionResponse ?

Not currently it seems.

@tihomir FYI, previously I was fetching options from an untyped stub as suggested here:

But I don’t think this is correct. I believe it just points to the locally given options.

Hi @blynch
Have you got it working?
I am also looking for a way to change the cron schedule for a running cron workflow.