@@ -33,33 +33,56 @@ public interface ActivityExecutionContext {
3333 <V > void heartbeat (V details ) throws ActivityCompletionException ;
3434
3535 /**
36- * Extracts Heartbeat details from the last failed attempt. This is used in combination with retry
37- * options. An Activity Execution could be scheduled with optional {@link
38- * io.temporal.common.RetryOptions} via {@link io.temporal.activity.ActivityOptions}. If an
39- * Activity Execution failed then the server would attempt to dispatch another Activity Task to
40- * retry the execution according to the retry options. If there were Heartbeat details reported by
41- * the last Activity Execution that failed, they would be delivered along with the Activity Task
42- * for the next retry attempt and can be extracted by the Activity implementation.
36+ * Extracts Heartbeat details from the last heartbeat of this Activity Execution attempt. If there
37+ * were no heartbeats in this attempt, details from the last failed attempt are returned instead.
38+ * This is used in combination with retry options. An Activity Execution could be scheduled with
39+ * optional {@link io.temporal.common.RetryOptions} via {@link
40+ * io.temporal.activity.ActivityOptions}. If an Activity Execution failed then the server would
41+ * attempt to dispatch another Activity Task to retry the execution according to the retry
42+ * options. If there were Heartbeat details reported by the last Activity Execution that failed,
43+ * they would be delivered along with the Activity Task for the next retry attempt and can be
44+ * extracted by the Activity implementation.
4345 *
4446 * @param detailsClass Class of the Heartbeat details
4547 */
4648 <V > Optional <V > getHeartbeatDetails (Class <V > detailsClass );
4749
4850 /**
49- * Extracts Heartbeat details from the last failed attempt. This is used in combination with retry
50- * options. An Activity Execution could be scheduled with optional {@link
51- * io.temporal.common.RetryOptions} via {@link io.temporal.activity.ActivityOptions}. If an
52- * Activity Execution failed then the server would attempt to dispatch another Activity Task to
53- * retry the execution according to the retry options. If there were Heartbeat details reported by
54- * the last Activity Execution that failed, the details would be delivered along with the Activity
55- * Task for the next retry attempt. The Activity implementation can extract the details via {@link
56- * #getHeartbeatDetails(Class)}() and resume progress.
51+ * Extracts Heartbeat details from the last heartbeat of this Activity Execution attempt. If there
52+ * were no heartbeats in this attempt, details from the last failed attempt are returned instead.
53+ * It is useful in combination with retry options. An Activity Execution could be scheduled with
54+ * optional {@link io.temporal.common.RetryOptions} via {@link
55+ * io.temporal.activity.ActivityOptions}. If an Activity Execution failed then the server would
56+ * attempt to dispatch another Activity Task to retry the execution according to the retry
57+ * options. If there were Heartbeat details reported by the last Activity Execution that failed,
58+ * the details would be delivered along with the Activity Task for the next retry attempt. The
59+ * Activity implementation can extract the details via {@link #getHeartbeatDetails(Class)}() and
60+ * resume progress.
5761 *
5862 * @param detailsClass Class of the Heartbeat details
5963 * @param detailsGenericType Type of the Heartbeat details
6064 */
6165 <V > Optional <V > getHeartbeatDetails (Class <V > detailsClass , Type detailsGenericType );
6266
67+ /**
68+ * Returns details from the last failed attempt of this Activity Execution. Unlike {@link
69+ * #getHeartbeatDetails(Class)}, the returned details are not updated on every heartbeat call
70+ * within the current attempt.
71+ *
72+ * @param detailsClass Class of the Heartbeat details
73+ */
74+ <V > Optional <V > getLastHeartbeatDetails (Class <V > detailsClass );
75+
76+ /**
77+ * Returns details from the last failed attempt of this Activity Execution. Unlike {@link
78+ * #getHeartbeatDetails(Class, Type)}, the returned details are not updated on every heartbeat
79+ * call within the current attempt.
80+ *
81+ * @param detailsClass Class of the Heartbeat details
82+ * @param detailsGenericType Type of the Heartbeat details
83+ */
84+ <V > Optional <V > getLastHeartbeatDetails (Class <V > detailsClass , Type detailsGenericType );
85+
6386 /**
6487 * Gets a correlation token that can be used to complete the Activity Execution asynchronously
6588 * through {@link io.temporal.client.ActivityCompletionClient#complete(byte[], Object)}.
0 commit comments