@@ -33,33 +33,56 @@ public interface ActivityExecutionContext {
33
33
<V > void heartbeat (V details ) throws ActivityCompletionException ;
34
34
35
35
/**
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.
43
45
*
44
46
* @param detailsClass Class of the Heartbeat details
45
47
*/
46
48
<V > Optional <V > getHeartbeatDetails (Class <V > detailsClass );
47
49
48
50
/**
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.
57
61
*
58
62
* @param detailsClass Class of the Heartbeat details
59
63
* @param detailsGenericType Type of the Heartbeat details
60
64
*/
61
65
<V > Optional <V > getHeartbeatDetails (Class <V > detailsClass , Type detailsGenericType );
62
66
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
+
63
86
/**
64
87
* Gets a correlation token that can be used to complete the Activity Execution asynchronously
65
88
* through {@link io.temporal.client.ActivityCompletionClient#complete(byte[], Object)}.
0 commit comments