temporalio / temporalio/sdk-java
Ability to specify activity timeouts via annotation in Java SDK
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
Is your feature request related to a problem? Please describe.
In the Java SDK, you have an @ActivityInterface with multiple @ActivityMethods. The latter is the actual unit of execution. However, you specify retry and timeout options on the activity stub, which is based on the interface, so in order to have specific config for each activity you have to go out of your way and break up the interface into small pieces, which kinda defeats one of the nicest features of Temporal which is to just program your service as if it were native code. You can configure specific settings per method, but you have to use strings for activity names instead of strongly typed constructs, and still the activity-stub level config takes precedence.
Recently, I became aware of the @MethodRetry annotation, which is great, but it only allows you to specify retry options, not timeouts, so it falls short of addressing the basic issue.
Describe the solution you'd like
Either an additional set of parameters in @MethodRetry or a new annotation (e.g. @ActivityTimeouts) that allows me to specify activity timeouts (start-to-close and schedule-to-close) at the method level.
Describe alternatives you've considered
Specifying per-activity config using WorkflowImplementationOptions, but you have to use strings for activity names instead of strongly typed constructs, and still the activity-stub level config takes precedence.
Additional context
N/A.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how @ActivityInterface, @ActivityMethod, @MethodRetry, activity stubs, and WorkflowImplementationOptions currently define retry and timeout behavior. Compare the method-level and stub-level precedence, then define and test an annotation-based API that supports start-to-close and schedule-to-close timeouts without string activity names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100