File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
src/main/java/com/uber/cadence/worker Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -173,17 +173,18 @@ Sometimes an activity lifecycle goes beyond a synchronous method invocation. For
173
173
and later a reply comes and picked up by a different worker process. The whole such request-reply interaction can be modeled
174
174
as a single Cadence activity.
175
175
176
- To indicate that an activity should not be completed upon its method return annotate it with @DoNotCompleteOnReturn .
176
+ To indicate that an activity should not be completed upon its method return call Activity.doNotCompleteOnReturn() from the
177
+ original activity thread.
177
178
Then later when replies come complete it using [ ActivityCompletionClient] ( src/main/java/com/uber/cadence/client/ActivityCompletionClient.java ) .
178
179
To correlate activity invocation with completion use either ` TaskToken ` or workflow and activity ids.
179
180
``` java
180
181
public class FileProcessingActivitiesImpl implements FileProcessingActivities {
181
182
182
- @DoNotCompleteOnReturn
183
183
public String download (String bucketName , String remoteName , String localName ) {
184
184
byte [] taskToken = Activity . getTaskToken(); // Used to correlate reply
185
185
asyncDownloadFileFromS3(taskToken, bucketName, remoteName, localDirectory + localName);
186
- return " ignored" ; // Return value is ignored when annotated with @DoNotCompleteOnReturn
186
+ Activity . doNotCompleteOnReturn();
187
+ return " ignored" ; // Return value is ignored when doNotCompleteOnReturn was called.
187
188
}
188
189
...
189
190
}
Original file line number Diff line number Diff line change @@ -148,6 +148,10 @@ private SingleWorkerOptions toWorkflowOptions(WorkerOptions options) {
148
148
* </p>
149
149
*/
150
150
public void registerWorkflowImplementationTypes (Class <?>... workflowImplementationClasses ) {
151
+ if (workflowWorker == null ) {
152
+ throw new IllegalStateException ("disableWorkflowWorker is set in worker options" );
153
+ }
154
+ checkNotStarted ();
151
155
workflowWorker .setWorkflowImplementationTypes (workflowImplementationClasses );
152
156
}
153
157
You can’t perform that action at this time.
0 commit comments