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> Rexecute(String activityName, Class<R> resultClass, ActivityInvocationOptions options, Object... args) Executes an Activity with options that apply only to this invocation.<R> RExecutes an activity by its type name and arguments.<R> Rexecute(String activityName, Class<R> resultClass, Type resultType, ActivityInvocationOptions options, Object... args) Executes an Activity with options that apply only to this invocation.<R> RExecutes an activity by its type name and arguments.<R> Promise<R> executeAsync(String activityName, Class<R> resultClass, ActivityInvocationOptions options, Object... args) Executes an Activity asynchronously with options that apply only to this invocation.<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, ActivityInvocationOptions options, Object... args) Executes an Activity asynchronously with options that apply only to this invocation.<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.
-
execute
<R> R execute(String activityName, Class<R> resultClass, ActivityInvocationOptions options, Object... args) Executes an Activity with options that apply only to this invocation. Blocks until completion.- Type Parameters:
R- return type.- Parameters:
activityName- name of an Activity type to execute.resultClass- expected return type of the Activity.options- options for this invocation.args- arguments of the Activity.- Returns:
- Activity result.
-
execute
<R> R execute(String activityName, Class<R> resultClass, Type resultType, ActivityInvocationOptions options, Object... args) Executes an Activity with options that apply only to this invocation. Blocks until completion.- Type Parameters:
R- return type.- Parameters:
activityName- name of an Activity type to execute.resultClass- expected return class of the Activity.resultType- expected return type of the Activity. Differs fromresultClassfor generic types.options- options for this invocation.args- arguments of the Activity.- Returns:
- 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.
-
executeAsync
<R> Promise<R> executeAsync(String activityName, Class<R> resultClass, ActivityInvocationOptions options, Object... args) Executes an Activity asynchronously with options that apply only to this invocation.- Type Parameters:
R- return type.- Parameters:
activityName- name of an Activity type to execute.resultClass- expected return type of the Activity.options- options for this invocation.args- arguments of the Activity.- Returns:
- Promise to the Activity result.
-
executeAsync
<R> Promise<R> executeAsync(String activityName, Class<R> resultClass, Type resultType, ActivityInvocationOptions options, Object... args) Executes an Activity asynchronously with options that apply only to this invocation.- Type Parameters:
R- return type.- Parameters:
activityName- name of an Activity type to execute.resultClass- expected return class of the Activity.resultType- expected return type of the Activity. Differs fromresultClassfor generic types.options- options for this invocation.args- arguments of the Activity.- Returns:
- Promise to the Activity result.
-