File tree Expand file tree Collapse file tree 3 files changed +49
-5
lines changed
src/main/java/com/uber/cadence/migration Expand file tree Collapse file tree 3 files changed +49
-5
lines changed Original file line number Diff line number Diff line change 19
19
20
20
import com .uber .cadence .RequestCancelWorkflowExecutionRequest ;
21
21
import com .uber .cadence .StartWorkflowExecutionRequest ;
22
- import com .uber .cadence .StartWorkflowExecutionResponse ;
23
22
import com .uber .cadence .activity .ActivityMethod ;
24
23
25
24
public interface MigrationActivities {
25
+ /**
26
+ * Starts a new workflow execution in a new domain.
27
+ *
28
+ * @param request The request to start the workflow in new domain.
29
+ * @return A response indicating the status of the operation.
30
+ */
26
31
@ ActivityMethod
27
- StartWorkflowExecutionResponse startWorkflowInNewDomain (StartWorkflowExecutionRequest request );
32
+ StartWorkflowInNewResponse startWorkflowInNewDomain (StartWorkflowExecutionRequest request );
28
33
34
+ /**
35
+ * Cancels a workflow execution in the current domain.
36
+ *
37
+ * @param request The request to cancel the workflow.
38
+ */
29
39
@ ActivityMethod
30
40
void cancelWorkflowInCurrentDomain (RequestCancelWorkflowExecutionRequest request );
31
41
}
Original file line number Diff line number Diff line change 19
19
20
20
import com .uber .cadence .RequestCancelWorkflowExecutionRequest ;
21
21
import com .uber .cadence .StartWorkflowExecutionRequest ;
22
- import com .uber .cadence .StartWorkflowExecutionResponse ;
22
+ import com .uber .cadence .WorkflowExecutionAlreadyStartedError ;
23
23
import com .uber .cadence .client .WorkflowClient ;
24
24
import com .uber .cadence .workflow .Workflow ;
25
25
@@ -33,10 +33,14 @@ public MigrationActivitiesImpl(
33
33
}
34
34
35
35
@ Override
36
- public StartWorkflowExecutionResponse startWorkflowInNewDomain (
36
+ public StartWorkflowInNewResponse startWorkflowInNewDomain (
37
37
StartWorkflowExecutionRequest request ) {
38
38
try {
39
- return clientInNewDomain .getService ().StartWorkflowExecution (request );
39
+ return new StartWorkflowInNewResponse (
40
+ clientInNewDomain .getService ().StartWorkflowExecution (request ),
41
+ "New workflow starting successful" );
42
+ } catch (WorkflowExecutionAlreadyStartedError e ) {
43
+ return new StartWorkflowInNewResponse (null , "Workflow already started" );
40
44
} catch (Exception e ) {
41
45
throw Workflow .wrap (e );
42
46
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Modifications copyright (C) 2017 Uber Technologies, Inc.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not
7
+ * use this file except in compliance with the License. A copy of the License is
8
+ * located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed on
13
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+
18
+ package com .uber .cadence .migration ;
19
+
20
+ import com .uber .cadence .StartWorkflowExecutionResponse ;
21
+
22
+ public class StartWorkflowInNewResponse {
23
+ StartWorkflowExecutionResponse startWorkflowExecutionResponse ;
24
+ String status ;
25
+
26
+ StartWorkflowInNewResponse (StartWorkflowExecutionResponse startWorkflowResponse , String msg ) {
27
+ startWorkflowExecutionResponse = startWorkflowResponse ;
28
+ status = msg ;
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments