temporalio / temporalio/sdk-java

Ability to specify activity timeouts via annotation in Java SDK

Open
#2,051 0 comments 0 reactions 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

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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.