use of com.uber.cadence.StartWorkflowExecutionResponse in project cadence-client by uber-java.
the class TestWorkflowService method startWorkflowExecutionNoRunningCheck.
private StartWorkflowExecutionResponse startWorkflowExecutionNoRunningCheck(StartWorkflowExecutionRequest startRequest, Optional<TestWorkflowMutableState> parent, WorkflowId workflowId) throws InternalServiceError, BadRequestError {
String domain = startRequest.getDomain();
TestWorkflowMutableState result = new TestWorkflowMutableStateImpl(startRequest, parent, this, store);
WorkflowExecution execution = result.getExecutionId().getExecution();
ExecutionId executionId = new ExecutionId(domain, execution);
lock.lock();
try {
openExecutions.put(workflowId, result);
executions.put(executionId, result);
} finally {
lock.unlock();
}
result.startWorkflow();
return new StartWorkflowExecutionResponse().setRunId(execution.getRunId());
}
use of com.uber.cadence.StartWorkflowExecutionResponse in project cadence-client by uber-java.
the class TestWorkflowService method continueAsNew.
/**
* Creates next run of a workflow execution
*
* @return RunId
*/
public String continueAsNew(StartWorkflowExecutionRequest previousRunStartRequest, WorkflowExecutionContinuedAsNewEventAttributes a, String identity, ExecutionId executionId, Optional<TestWorkflowMutableState> parent) throws InternalServiceError, BadRequestError {
StartWorkflowExecutionRequest startRequest = new StartWorkflowExecutionRequest().setInput(a.getInput()).setWorkflowType(a.getWorkflowType()).setExecutionStartToCloseTimeoutSeconds(a.getExecutionStartToCloseTimeoutSeconds()).setTaskStartToCloseTimeoutSeconds(a.getTaskStartToCloseTimeoutSeconds()).setDomain(executionId.getDomain()).setTaskList(a.getTaskList()).setWorkflowId(executionId.getWorkflowId().getWorkflowId()).setWorkflowIdReusePolicy(previousRunStartRequest.getWorkflowIdReusePolicy()).setIdentity(identity);
StartWorkflowExecutionResponse response = startWorkflowExecutionNoRunningCheck(startRequest, parent, executionId.getWorkflowId());
return response.getRunId();
}
use of com.uber.cadence.StartWorkflowExecutionResponse in project cadence-client by uber-java.
the class GenericWorkflowClientExternalImpl method startWorkflow.
@Override
public WorkflowExecution startWorkflow(StartWorkflowExecutionParameters startParameters) throws WorkflowExecutionAlreadyStartedError {
StartWorkflowExecutionRequest request = new StartWorkflowExecutionRequest();
request.setDomain(domain);
request.setInput(startParameters.getInput());
request.setExecutionStartToCloseTimeoutSeconds((int) startParameters.getExecutionStartToCloseTimeoutSeconds());
request.setTaskStartToCloseTimeoutSeconds((int) startParameters.getTaskStartToCloseTimeoutSeconds());
request.setWorkflowIdReusePolicy(startParameters.getWorkflowIdReusePolicy());
String taskList = startParameters.getTaskList();
if (taskList != null && !taskList.isEmpty()) {
TaskList tl = new TaskList();
tl.setName(taskList);
request.setTaskList(tl);
}
String workflowId = startParameters.getWorkflowId();
if (workflowId == null) {
workflowId = UUID.randomUUID().toString();
}
request.setWorkflowId(workflowId);
request.setWorkflowType(startParameters.getWorkflowType());
// if(startParameters.getChildPolicy() != null) {
// request.setChildPolicy(startParameters.getChildPolicy());
// }
StartWorkflowExecutionResponse result;
try {
result = service.StartWorkflowExecution(request);
} catch (WorkflowExecutionAlreadyStartedError e) {
throw e;
} catch (TException e) {
throw CheckedExceptionWrapper.wrap(e);
}
WorkflowExecution execution = new WorkflowExecution();
execution.setRunId(result.getRunId());
execution.setWorkflowId(request.getWorkflowId());
return execution;
}
Aggregations