Package io.temporal.activity
Annotation Type ActivityInterface
-
@Retention(RUNTIME) @Target(TYPE) public @interface ActivityInterfaceIndicates that an interface is an activity interface. Only interfaces annotated with this annotation can be used as parameters toWorkflow.newActivityStub(Class)methods.Each method of the interface annotated with
ActivityInterfaceincluding inherited from interfaces is a separate activity. By default, the name of an activity type is its method name with the first letter capitalized. UsenamePrefix()or {ActivityMethod.name()} to make sure that activity type names are distinct.Example:
Whenpublic interface A { a(); } @ActivityInterface(namePrefix = "B_") public interface B extends A { b(); } @ActivityInterface(namePrefix = "C_") public interface C extends B { c(); } public class CImpl implements C { public void a() {} public void b() {} public void c() {} }CImplinstance is registered with theWorkerthe following activities are registered:- B_a
- B_b
- C_c
BandCinterfaces. A call to crate stub toAinterface will fail asAis not annotated with ActivityInterface.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringnamePrefixPrefix to prepend to method names to generate activity types.
-
-
-
Element Detail
-
namePrefix
java.lang.String namePrefix
Prefix to prepend to method names to generate activity types. Default is empty string which means that method names are used as activity types.Note that this value is ignored if a name of an activity is specified explicitly through
ActivityMethod.name().Be careful about names that contain special characters. These names can be used as metric tags. And systems like prometheus ignore metrics which have tags with unsupported characters.
- Default:
- ""
-
-