Interface ActivityStub
public interface ActivityStub
ActivityStub is used to call an activity without referencing an interface it implements. This is
useful to call activities when their type is not known at compile time or to execute activities
implemented in other languages. Created through
Workflow.newActivityStub(Class).-
Method Summary
Modifier and TypeMethodDescription<R> RExecutes an activity by its type name and arguments.<R> RExecutes an activity by its type name and arguments.<R> Promise<R> executeAsync(String activityName, Class<R> resultClass, Object... args) Executes an activity asynchronously by its type name and arguments.<R> Promise<R> executeAsync(String activityName, Class<R> resultClass, Type resultType, Object... args) Executes an activity asynchronously by its type name and arguments.
-
Method Details
-
execute
Executes an activity by its type name and arguments. Blocks until the activity completion.- Type Parameters:
R- return type.- Parameters:
activityName- name of an activity type to execute.resultClass- the expected return type of the activity. Use Void.class for activities that return void type.args- arguments of the activity.- Returns:
- an activity result.
-
execute
Executes an activity by its type name and arguments. Blocks until the activity completion.- Type Parameters:
R- return type.- Parameters:
activityName- name of an activity type to execute.resultClass- the expected return class of the activity. Use Void.class for activities that return void type.resultType- the expected return type of the activity. Differs from resultClass for generic types.args- arguments of the activity.- Returns:
- an activity result.
-
executeAsync
Executes an activity asynchronously by its type name and arguments.- Type Parameters:
R- return type.- Parameters:
activityName- name of an activity type to execute.resultClass- the expected return type of the activity. Use Void.class for activities that return void type.args- arguments of the activity.- Returns:
- Promise to the activity result.
-
executeAsync
<R> Promise<R> executeAsync(String activityName, Class<R> resultClass, Type resultType, Object... args) Executes an activity asynchronously by its type name and arguments.- Type Parameters:
R- return type.- Parameters:
activityName- name of an activity type to execute.resultClass- the expected return class of the activity. Use Void.class for activities that return void type.resultType- the expected return type of the activity. Differs from resultClass for generic types.args- arguments of the activity.- Returns:
- Promise to the activity result.
-