cadence-java-client
cadence-java-client copied to clipboard
Memo field is not propagated to new instance after calling continueAsNew
For a workflow, where "memo" field is set through WorkflowOptions, calling continueAsNew fails to propagate the value to subsequent instances. So any subsequent invocation of "describe workflow" will have null values for memo.
Steps to reproduce the issue:
// setup up workflow options
String wfId = "greeting101";
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
WorkflowOptions options = new WorkflowOptions.Builder().setWorkflowId(wfId).setMemo(map).build();
GreetingWorkflow workflow = workflowClient.newWorkflowStub(GreetingWorkflow.class, options);
// start the workflow
GreetingWorkflow workflow = workflowClient.newWorkflowStub(GreetingWorkflow.class);
WorkflowClient.start(workflow::getGreeting, "World");
// ensure continueAsNew is invoked in the workflow inside workflow
// Current workflow run stops executing after this call.
if (forSomeCondition()) continueAsNew.composeGreeting(greeting, name, delay, counter);
// invoke describe workflow
WorkflowExecution workflowExecution = new WorkflowExecution();
workflowExecution.setWorkflowId(wfId);
WorkflowExecutionInfo workflowExecutionInfo = WorkflowExecutionUtils.describeWorkflowInstance(
cadenceService,
cadenceServerConfig.getDomain(),
workflowExecution);
Map<String,Object> memo = workflowExecutionInfo.memo;
assertNull(memo) <--- memo is null