I’m looking for how I can invoke activities from a workflow such that they are retried if they fail? I see potential references in the sdk, such as the RetryOptions
interface, but it doesn’t appear that they are used anywhere.
cc: @bergundy
I’m looking for how I can invoke activities from a workflow such that they are retried if they fail? I see potential references in the sdk, such as the RetryOptions
interface, but it doesn’t appear that they are used anywhere.
cc: @bergundy
BTW by default any activity gets retry options (provided by the service) with 1 second initial interval, 2.0 coefficient and 100 seconds maximum retry interval.
I’ll let @bergundy answer the Node specific part.
Just to provide a little more context of what I’m attempting. My workflow runs two activities. The first just returns a string. I’ve constructed the second activity to fail most of the time, but occasionally succeed. I wanted to do this to see if I could watch it fail and then succeed.
Here is what I see in the web console. The error message, “Error: error reaching…” is the error message I’m intentionally returning from the second activity. I’m surprised that I only see one activity attempt (presumably the first, which was successful).
It occurs to me that I’m probably violating this advice from the docs and that my workflow code is actually executing my second activity directly without queueing it up:
I’m experimenting with clojurescript and need to figure out how to do this without typescript.
Yes, I don’t see any activity related event in the workflow history you posted. So it is not really an activity from the Temporal point of view.
We’re probably going to remove the import hack for activities, you’re not the first one to fall for this.
To set retry options for activities see this example:
Namespace: workflow | Temporal Node.js SDK API Reference, the retry options can be provided as part of the activity options in Context.configure
.
For Workflow retry options pass them in with the workflow options when creating a stub: Namespace: client | Temporal Node.js SDK API Reference