Hi
We have a usecase of continuous loop, and thinking to use continueasNew, we want to do
new execution will not carry over any history from the old execution. https://cadenceworkflow.io/docs/go-client/continue-as-new/
I see this API in go sdk, but not in java.
Do we have any equivalent in java sdk or alternative way
Thanks! but this sample is slightly different than I need.
The following is the usacses.
step1:
step2:
step3:
step4: while
step5:
…
The workflow started with step1 and entered the while loop and the while loop is running lets say 100000. To avoid the history getting accumulated, I want to invoke each 1000 itereations a new workflow(continuedAsNew) but that will start the flow again.
The link says ttps://cadenceworkflow.io/docs/go-client/continue-as-new/
The new execution will not carry over any history from the old execution. To trigger this behavior, the Workflow function should terminate by returning the special ContinueAsNewError error:
The same is not found din java sdk ContinueAsNewError, I want to understand l
The continue as new restarts the workflow with the same WorkflowId from the beginning. The previous run of the workflow can pass arguments to the next one.
The workflow started with step1 and entered the while loop and the while loop is running lets say 100000. To avoid the history getting accumulated, I want to invoke each 1000 itereations a new workflow(continuedAsNew) but that will start the flow again.
If you want to use continue as new only for the step4 loop then consider executing it in a child workflow. The parent doesn’t see that child called continue as new, it is only notified when the last child run is completed.
The same is not found din java sdk ContinueAsNewError, I want to understand l
The continue as new is implemented on the server side. So the semantic is exactly the same for all SDKs. In Java as soon as the workflow method of the continue as new stub is called the workflow run ends and the new one starts from the beginning.