|
163 | 163 | * }
|
164 | 164 | * </code></pre>
|
165 | 165 | *
|
| 166 | + * <p>Caution: since using this sometimes implies "long" timeouts, activity-worker losses prior to recording the |
| 167 | + * {@link Activity#getTaskToken()} in an external system (or prior to another thread calling it) may not be noticed |
| 168 | + * until the "long" timeout occurs. This can be resolved by having another system call |
| 169 | + * {@link com.uber.cadence.client.ActivityCompletionClient#heartbeat(byte[], Object)} while that external action is |
| 170 | + * running, but there is currently no way to mitigate this issue without these heartbeats. For in-process-only async |
| 171 | + * completion, relying on heartbeating is safe and reliable because these heartbeats should occur as long as the |
| 172 | + * process / background thread is still running. |
| 173 | + * |
| 174 | + * <p>If you cannot heartbeat and cannot tolerate this kind of delayed-activity-loss detection, consider emulating a |
| 175 | + * long activity via a signal channel instead: you can start a short-lived activity and wait for a "saved to external |
| 176 | + * system" signal, retrying as necessary, and then wait for an "external system finished" signal containing the final |
| 177 | + * result. |
| 178 | + * |
166 | 179 | * <h3>Activity Heartbeating</h3>
|
167 | 180 | *
|
168 | 181 | * <p>Some activities are long running. To react to their crashes quickly, use a heartbeat
|
|
201 | 214 | public final class Activity {
|
202 | 215 |
|
203 | 216 | /**
|
204 |
| - * If this method is called during an activity execution then activity is not going to complete |
| 217 | + * If this method is called during an activity execution then activity will not complete |
205 | 218 | * when its method returns. It is expected to be completed asynchronously using {@link
|
206 | 219 | * com.uber.cadence.client.ActivityCompletionClient}.
|
| 220 | + * |
| 221 | + * <p>Caution: since using this sometimes implies "long" timeouts, activity-worker losses prior to recording the |
| 222 | + * {@link Activity#getTaskToken()} in an external system (or prior to another thread calling it) may not be noticed |
| 223 | + * until the "long" timeout occurs. |
| 224 | + * This can be resolved by having another system call |
| 225 | + * {@link com.uber.cadence.client.ActivityCompletionClient#heartbeat(byte[], Object)} while that external action is |
| 226 | + * running, but there is currently no way to mitigate this issue without these heartbeats. For in-process-only async |
| 227 | + * completion, relying on heartbeating is safe and reliable because these heartbeats should occur as long as the |
| 228 | + * process / background thread is still running. |
| 229 | + * |
| 230 | + * <p>If you cannot heartbeat and cannot tolerate this kind of delayed-activity-loss detection, consider emulating a |
| 231 | + * long activity via a signal channel instead: you can start a short-lived activity and wait for a "saved to external |
| 232 | + * system" signal, retrying as necessary, and then wait for an "external system finished" signal containing the final |
| 233 | + * result. |
207 | 234 | */
|
208 | 235 | public static void doNotCompleteOnReturn() {
|
209 | 236 | ActivityInternal.doNotCompleteOnReturn();
|
|
0 commit comments