Package io.temporal.workflow
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 throughWorkflow.newActivityStub(Class)
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <R> R
execute(java.lang.String activityName, java.lang.Class<R> resultClass, java.lang.Object... args)
Executes an activity by its type name and arguments.<R> R
execute(java.lang.String activityName, java.lang.Class<R> resultClass, java.lang.reflect.Type resultType, java.lang.Object... args)
Executes an activity by its type name and arguments.<R> Promise<R>
executeAsync(java.lang.String activityName, java.lang.Class<R> resultClass, java.lang.Object... args)
Executes an activity asynchronously by its type name and arguments.<R> Promise<R>
executeAsync(java.lang.String activityName, java.lang.Class<R> resultClass, java.lang.reflect.Type resultType, java.lang.Object... args)
Executes an activity asynchronously by its type name and arguments.
-
-
-
Method Detail
-
execute
<R> R execute(java.lang.String activityName, java.lang.Class<R> resultClass, java.lang.Object... args)
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
<R> R execute(java.lang.String activityName, java.lang.Class<R> resultClass, java.lang.reflect.Type resultType, java.lang.Object... args)
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
<R> Promise<R> executeAsync(java.lang.String activityName, java.lang.Class<R> resultClass, java.lang.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 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(java.lang.String activityName, java.lang.Class<R> resultClass, java.lang.reflect.Type resultType, java.lang.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.
-
-