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 1e1ac46 commit 83c6e1d
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,32 +155,34 @@ public void initWorkers(String packagesToScan) {
}

private String startWorkflow(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());
request.setWorkflowDef(workflowDef);

return workflowClient.startWorkflow(request);
}

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

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

public CompletableFuture<Workflow> executeWorkflow(ConductorWorkflow conductorWorkflow, Object input) {
String workflowId = this.startWorkflow(conductorWorkflow.getName(), conductorWorkflow.getVersion(), conductorWorkflow.toWorkflowDef(), input);
CompletableFuture<Workflow> future = new CompletableFuture<>();
runningWorkflowFutures.put(workflowId, future);
return future;
}
Expand Down

0 comments on commit 83c6e1d

Please sign in to comment.