Annotation Type WorkflowInterface
-
@Retention(RUNTIME) @Target(TYPE) public @interface WorkflowInterfaceWorkflowInterface annotation indicates that an interface is a Workflow interface. Only interfaces annotated with this annotation can be used as parameters toWorkflowClient.newWorkflowStub(Class, WorkflowOptions)andWorkflow.newChildWorkflowStub(Class)methods.All methods of an interface annotated with WorkflowInterface must have one of the following annotations: @WorkflowMethod, @SignalMethod or @QueryMethod
An interface annotated with WorkflowInterface can extend other interfaces annotated with WorkflowInterface having that it can have at most one method annotated with @WorkflowMethod including all inherited methods.
The prefix of workflow, signal and query type names is the name of the declaring interface annotated with WorkflowInterface. If a method is declared in non annotated interface the prefix comes from the first sub-interface that has the WorkflowInterface annotation.
A workflow implementation object must have exactly one method annotated with @WorkflowMethod inherited from all the interfaces it implements.
Example:
Whenpublic interface A { @SignalMethod a(); aa(); } @WorkflowInterface public interface B extends A { @SignalMethod b(); @SignalMethod // must define the type of the inherited method aa(); } @WorkflowInterface public interface C extends B { @WorkflowMethod c(); } @WorkflowInterface public interface D extends C { @QueryMethod String d(); } public class CImpl implements C { public void a() {} public void aa() {} public void b() {} public void c() {} public String d() { return "foo"; } }CImplinstance is registered with theWorkerthe following is registered:- a signal handler
- b signal handler
- aa signal handler
- c workflow main method
- d query method
B,CandDinterfaces. A call to crate a stub toAinterface will fail asAis not annotated with the WorkflowInterface.