Hi there,
I’m trying a very simple child workflow example where a parent workflow spawns a child workflow which simply throws an exception. On spawning the child workflow I have set the retry policy to allow maximum 1 attempt.
However I have observed in the worker log that the worker keeps retrying on the child workflow. I’m new to temporal but would be great if someone can point me where I’m missing. Thanks a lot!
Here’s the parent workflow impl code. Note the retryOptions configuration:
public class ParentWorkflowImpl implements ParentWorkflow {
@Override
public void parentWorkflowMethod() {
ChildWorkflowOptions options = ChildWorkflowOptions.newBuilder()
.setWorkflowId("child-workflow-id")
.setRetryOptions(RetryOptions.newBuilder()
.setInitialInterval(Duration.ofSeconds(1))
.setMaximumAttempts(1).build())
.build();
ChildWorkflow child = Workflow.newChildWorkflowStub(ChildWorkflow.class, options);
try {
child.childWorkflowMethod();
} catch (ChildWorkflowFailure e) {
System.err.println("Child Workflow failed with: " + e.getMessage());
throw e;
}
}
}
Here’s the child workflow impl
public class ChildWorkflowImpl implements ChildWorkflow {
@Override
public void childWorkflowMethod() {
throw new RuntimeException("Child workflow failed!");
}
}