sdk-java icon indicating copy to clipboard operation
sdk-java copied to clipboard

Support for using Temporal Annotations as Meta Annotation

Open madhur-spotnana opened this issue 3 years ago • 0 comments

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.

madhur-spotnana avatar Aug 01 '23 18:08 madhur-spotnana