temporalio / temporalio/sdk-java

In case of existing workflow both sync and async executions should have an option to error out or return an existing execution

Open
#1,025 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
433
Forks
249
Avg merge
5d 6h
Merged PRs (30d)
26

Description

In addition to WorkflowReusePolicy, GoSDK has a flag

https://github.com/temporalio/sdk-go/blob/57736850f55b2b3e17cffa0e3493c4e0d6de831f/internal/client.go#L529

// When WorkflowExecutionErrorWhenAlreadyStarted is true, Client.ExecuteWorkflow will return an error if the
// workflow id has already been used and WorkflowIDReusePolicy would disallow a re-run. If it is set to false,
// rather than erroring a WorkflowRun instance representing the current or last run will be returned.
//
// Optional: defaults to false
WorkflowExecutionErrorWhenAlreadyStarted bool

That enabled an explicit failing of the workflow start if WorkflowReusePolicy disallowed an execution instead of returning the old execution.

This has to be added to JavaSDK, otherwise, there is no way for users to get the fact that the start request was disallowed and the returned execution is an old execution.

One of the discussions on this topic:
C02E8TQA01G-1673406348.075879.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the Go SDK flag in internal/client.go with the Java SDK's synchronous and asynchronous workflow-start entry points. Trace WorkflowReusePolicy handling and define completion as allowing both execution modes to either report a disallowed start as an error or return the existing execution, with corresponding behavior covered by the SDK's tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.