diff --git a/temporal-sdk/src/main/java/io/temporal/activity/ActivityInfo.java b/temporal-sdk/src/main/java/io/temporal/activity/ActivityInfo.java index f456dbdf5..d57acd7f9 100644 --- a/temporal-sdk/src/main/java/io/temporal/activity/ActivityInfo.java +++ b/temporal-sdk/src/main/java/io/temporal/activity/ActivityInfo.java @@ -71,7 +71,7 @@ public interface ActivityInfo { String getActivityNamespace(); - /** Activity execution attempt starting from 0. */ + /** Activity execution attempt starting from 1. */ int getAttempt(); /** Is this activity invoked as a local activity? */ diff --git a/temporal-sdk/src/main/java/io/temporal/activity/ActivityInterface.java b/temporal-sdk/src/main/java/io/temporal/activity/ActivityInterface.java index eb90bb9d9..10f8b6439 100644 --- a/temporal-sdk/src/main/java/io/temporal/activity/ActivityInterface.java +++ b/temporal-sdk/src/main/java/io/temporal/activity/ActivityInterface.java @@ -30,8 +30,9 @@ * annotation can be used as parameters to {@link Workflow#newActivityStub(Class)} methods. * *
Each method of the interface annotated with ActivityInterface
including inherited
- * from interfaces is a separate activity. By default the name of an activity type is "short
- * interface name"_"method name".
+ * from interfaces is a separate activity. By default the name of an activity type is its method
+ * name with the first letter capitalized. Use {@link ActivityInterface#namePrefix()} or {{@link
+ * ActivityMethod#name()}} to make sure that activity type names are distinct.
*
*
Example: * @@ -40,12 +41,12 @@ * a(); * } * - * {@literal @}ActivityInterface + * {@literal @}ActivityInterface(namePrefix = "B_") * public interface B extends A { * b(); * } * - * {@literal @}ActivityInterface + * {@literal @}ActivityInterface(namePrefix = "C_") * public interface C extends B { * c(); * } @@ -68,8 +69,7 @@ *
a()
is registered as "B_a" because interface A
lacks
- * ActivityInterface annotation. The workflow code can call activities through stubs to B
+ * The workflow code can call activities through stubs to B
*
and C
interfaces. A call to crate stub to A
interface will fail
* as A
is not annotated with ActivityInterface.
*/
@@ -80,6 +80,9 @@
* 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
+ * {@link 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.
*/
diff --git a/temporal-sdk/src/main/java/io/temporal/activity/ActivityMethod.java b/temporal-sdk/src/main/java/io/temporal/activity/ActivityMethod.java
index ee036068a..2a39b9e42 100644
--- a/temporal-sdk/src/main/java/io/temporal/activity/ActivityMethod.java
+++ b/temporal-sdk/src/main/java/io/temporal/activity/ActivityMethod.java
@@ -34,7 +34,7 @@
/**
* Name of the activity type. Default is method name. Also consider using {@link
- * ActivityInterface#namePrefix()}.
+ * ActivityInterface#namePrefix()}. Note that the prefix is ignored if the name is specified.
*
*
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.
diff --git a/temporal-sdk/src/main/java/io/temporal/workflow/WorkflowInterface.java b/temporal-sdk/src/main/java/io/temporal/workflow/WorkflowInterface.java
index 5c1c115bc..566cf7b40 100644
--- a/temporal-sdk/src/main/java/io/temporal/workflow/WorkflowInterface.java
+++ b/temporal-sdk/src/main/java/io/temporal/workflow/WorkflowInterface.java
@@ -36,14 +36,14 @@
* annotations: {@literal @}WorkflowMethod, {@literal @}SignalMethod or {@literal @}QueryMethod
*
*
An interface annotated with WorkflowInterface can extend other interfaces annotated with
- * WorkflowInterface having that it can have at most one method annotated with
+ * WorkflowInterface having that it can have at most one method annotated with
* {@literal @}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
+ *
A workflow implementation object must have exactly one method annotated with
* {@literal @}WorkflowMethod inherited from all the interfaces it implements.
*
*
Example:
@@ -61,7 +61,7 @@
* {@literal @}SignalMethod
* b();
*
- * {@literal @}SignalMethod // must to define the type of the inherited method
+ * {@literal @}SignalMethod // must define the type of the inherited method
* aa();
* }
*
@@ -92,18 +92,16 @@
*
*
*
- * - B_a signal handler
- *
- B_b signal handler
- *
- B_aa signal handler
- *
- C_c workflow main method
- *
- D_d query method
+ *
- a signal handler
+ *
- b signal handler
+ *
- aa signal handler
+ *
- c workflow main method
+ *
- d query method
*
*
- * Note that methods a()
and aa()
are registered with "B_" prefix because
- * interface A
lacks the WorkflowInterface annotation. The client code can call signals
- * through stubs to B
, C
and D
interfaces. A call to crate a
- * stub to A
interface will fail as A
is not annotated with the
- * WorkflowInterface.
+ * The client code can call signals through stubs to B
, C
and D
+ *
interfaces. A call to crate a stub to A
interface will fail as A
+ *
is not annotated with the WorkflowInterface.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)