temporalio / temporalio/sdk-java

Support for using Temporal Annotations as Meta Annotation

Open
#1,832 0 comments 4 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.
I am using temporal with a spring boot project and trying to create a custom annotation for defining activity interfaces. I need this custom annotation to define default options for activities like startToCloseTimeout or taskQueue. This is how I am planning to create the annotation:

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@ActivityInterface
public @interface MyCustomAnnotation {

  long startToCloseTimeoutMs();

  String taskQueue();
}

This does not work because the @ActivityInterface cannot be used as meta annotation.

Describe the solution you'd like
Add support for using Temporal annotations (like @WorkflowInterface, @ActivityInterface, @WorkflowMethod) as meta annotations. To do this, the SDK needs to be modified to read the annotation using this, which recursively scans for annotation added as meta annotation.

Describe alternatives you've considered
To create this custom annotation I have used Byte Buddy to modify my activity interfaces at runtime and add the Temporal annotation where my custom annotation is present.

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 the SDK handles @WorkflowInterface, @ActivityInterface, and @WorkflowMethod annotations. Compare that behavior with Spring's AnnotationUtils.findAnnotation approach for recursively discovering meta annotations. Done means these Temporal annotations work when applied as meta annotations, including the custom activity options described in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.