Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Update WorkflowExecutor.java
Browse files Browse the repository at this point in the history
  • Loading branch information
youngledo authored Dec 1, 2023
1 parent 41d4334 commit 2348851
Showing 1 changed file with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,36 +154,35 @@ public void initWorkers(String packagesToScan) {
annotatedWorkerExecutor.initWorkers(packagesToScan);
}

public CompletableFuture<Workflow> executeWorkflow(String name, Integer version, Object input) {
private String doExecuteWorkflow(String name, Integer version, WorkflowDef workflowDef, Object input) {
CompletableFuture<Workflow> future = new CompletableFuture<>();
Map<String, Object> inputMap = objectMapper.convertValue(input, Map.class);

StartWorkflowRequest request = new StartWorkflowRequest();
request.setInput(inputMap);
request.setName(name);
request.setVersion(version);
request.setWorkflowDef(conductorWorkflow.toWorkflowDef());

String workflowId = workflowClient.startWorkflow(request);
return workflowClient.startWorkflow(request);
}

public String executeWorkflow(String name, Integer version, Object input) {
String workflowId = this.doExecuteWorkflow(name, version, input);
runningWorkflowFutures.put(workflowId, future);
return workflowId;
}

public CompletableFuture<Workflow> executeWorkflow(String name, Integer version, Object input) {
String workflowId = this.doExecuteWorkflow(name, version, input);
runningWorkflowFutures.put(workflowId, future);
return future;
}

public CompletableFuture<Workflow> executeWorkflow(
ConductorWorkflow conductorWorkflow, Object input) {

CompletableFuture<Workflow> future = new CompletableFuture<>();

Map<String, Object> inputMap = objectMapper.convertValue(input, Map.class);

StartWorkflowRequest request = new StartWorkflowRequest();
request.setInput(inputMap);
request.setName(conductorWorkflow.getName());
request.setVersion(conductorWorkflow.getVersion());
request.setWorkflowDef(conductorWorkflow.toWorkflowDef());

String workflowId = workflowClient.startWorkflow(request);
String workflowId = this.doExecuteWorkflow(conductorWorkflow.getName(), conductorWorkflow.getVersion(), conductorWorkflow.toWorkflowDef(), input);
runningWorkflowFutures.put(workflowId, future);

return future;
}

Expand Down

0 comments on commit 2348851

Please sign in to comment.