Skip to content

Commit fa40ace

Browse files
committed
bug fix for workflowAlreadyStarted
1 parent 8f153cf commit fa40ace

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/main/java/com/uber/cadence/migration/MigrationActivities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
public interface MigrationActivities {
2626
@ActivityMethod
27-
StartWorkflowExecutionResponse startWorkflowInNewDomain(StartWorkflowExecutionRequest request);
27+
StartWorkflowInNewResponse startWorkflowInNewDomain(StartWorkflowExecutionRequest request);
2828

2929
@ActivityMethod
3030
void cancelWorkflowInCurrentDomain(RequestCancelWorkflowExecutionRequest request);

src/main/java/com/uber/cadence/migration/MigrationActivitiesImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.uber.cadence.RequestCancelWorkflowExecutionRequest;
2121
import com.uber.cadence.StartWorkflowExecutionRequest;
2222
import com.uber.cadence.StartWorkflowExecutionResponse;
23+
import com.uber.cadence.WorkflowExecutionAlreadyStartedError;
2324
import com.uber.cadence.client.WorkflowClient;
2425
import com.uber.cadence.workflow.Workflow;
2526

@@ -33,10 +34,12 @@ public MigrationActivitiesImpl(
3334
}
3435

3536
@Override
36-
public StartWorkflowExecutionResponse startWorkflowInNewDomain(
37+
public StartWorkflowInNewResponse startWorkflowInNewDomain(
3738
StartWorkflowExecutionRequest request) {
3839
try {
39-
return clientInNewDomain.getService().StartWorkflowExecution(request);
40+
return new StartWorkflowInNewResponse(clientInNewDomain.getService().StartWorkflowExecution(request),"New workflow starting successful");
41+
} catch (WorkflowExecutionAlreadyStartedError e) {
42+
return new StartWorkflowInNewResponse(null,"Workflow already started");
4043
} catch (Exception e) {
4144
throw Workflow.wrap(e);
4245
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.uber.cadence.migration;
2+
3+
import com.uber.cadence.StartWorkflowExecutionResponse;
4+
5+
public class StartWorkflowInNewResponse {
6+
StartWorkflowExecutionResponse startWorkflowExecutionResponse;
7+
String message;
8+
9+
StartWorkflowInNewResponse(StartWorkflowExecutionResponse startWorkflowResponse, String msg){
10+
startWorkflowExecutionResponse = startWorkflowResponse;
11+
message = msg;
12+
}
13+
14+
}

0 commit comments

Comments
 (0)