Suppose I’m writing a workflow which uses an activity to call an API. The API accepts an idempotency key.
The workflow could call randomUUID()
to generate a safe, replayable UUID.
The activity execution also has access to its own activity id. If the activity id is unique, perhaps we could save a step and use it as our idempotency key?
However, What is a Temporal Activity? | Temporal Documentation says that a Workflow Run “may” reuse an Activity Id. The paragraph also says that the activity id “can be generated by the system, or it can be provided by the Workflow code that spawns the Activity Execution”. I was unclear here whether “a workflow run may reuse an activity id” applied to system generated activity ids, or only to activity ids provided by the workflow code.