I am executing an Async Workflow using the workflow client as shown below.
WorkflowClient.start(wflow::execute, flowContext);
When the workflow history size or count exceeds the limit, I am unable to catch this exception inside the Java code. The workflow gets terminated, and the status is updated as terminated.
How can I catch the exception related to exceeding the workflow history size or count limit in Java?
you can not, the workflow is terminated by the server which does not allow you to react in workflow code.
What you should do instead is to watch periodically the event history length, in your workflow code, and https://docs.temporal.io/workflows#continue-as-new if the same reach certain value. We don’t recommend going above 10k
I have a workflow where there are Async Activites. Since my workflow history or count exceeds limit, and I hope Workflow.continueAsNew(data) solve my problem.
Now, should I worry about my acitivty which will doNotCompleteOnReturn()?
How should I handle my activity before continueAsNew() is called ? Will it be taken care or should I do something ?