use of com.uber.cadence.WorkflowExecutionStartedEventAttributes in project cadence-client by uber-java.
the class WorkflowContext method getWorkflowStartedEventAttributes.
private WorkflowExecutionStartedEventAttributes getWorkflowStartedEventAttributes() {
HistoryEvent firstHistoryEvent = decisionTask.getHistory().getEvents().get(0);
WorkflowExecutionStartedEventAttributes attributes = firstHistoryEvent.getWorkflowExecutionStartedEventAttributes();
return attributes;
}
use of com.uber.cadence.WorkflowExecutionStartedEventAttributes in project cadence-client by uber-java.
the class StateMachines method startWorkflow.
private static void startWorkflow(RequestContext ctx, WorkflowData data, StartWorkflowExecutionRequest request, long notUsed) {
WorkflowExecutionStartedEventAttributes a = new WorkflowExecutionStartedEventAttributes().setIdentity(request.getIdentity()).setTaskStartToCloseTimeoutSeconds(request.getTaskStartToCloseTimeoutSeconds()).setWorkflowType(request.getWorkflowType()).setTaskList(request.getTaskList()).setExecutionStartToCloseTimeoutSeconds(request.getExecutionStartToCloseTimeoutSeconds()).setInput(request.getInput());
HistoryEvent event = new HistoryEvent().setEventType(EventType.WorkflowExecutionStarted).setWorkflowExecutionStartedEventAttributes(a);
ctx.addEvent(event);
}
use of com.uber.cadence.WorkflowExecutionStartedEventAttributes in project cadence-client by uber-java.
the class DecisionsHelper method continueAsNewWorkflowExecution.
void continueAsNewWorkflowExecution(ContinueAsNewWorkflowExecutionParameters continueParameters) {
WorkflowExecutionStartedEventAttributes startedEvent = task.getHistory().getEvents().get(0).getWorkflowExecutionStartedEventAttributes();
ContinueAsNewWorkflowExecutionDecisionAttributes attributes = new ContinueAsNewWorkflowExecutionDecisionAttributes();
attributes.setWorkflowType(task.getWorkflowType());
attributes.setInput(continueParameters.getInput());
int executionStartToClose = continueParameters.getExecutionStartToCloseTimeoutSeconds();
if (executionStartToClose == 0) {
executionStartToClose = startedEvent.getExecutionStartToCloseTimeoutSeconds();
}
attributes.setExecutionStartToCloseTimeoutSeconds(executionStartToClose);
int taskStartToClose = continueParameters.getTaskStartToCloseTimeoutSeconds();
if (taskStartToClose == 0) {
taskStartToClose = startedEvent.getTaskStartToCloseTimeoutSeconds();
}
attributes.setTaskStartToCloseTimeoutSeconds(taskStartToClose);
String taskList = continueParameters.getTaskList();
if (taskList == null || taskList.isEmpty()) {
taskList = startedEvent.getTaskList().getName();
}
TaskList tl = new TaskList();
tl.setName(taskList);
attributes.setTaskList(tl);
Decision decision = new Decision();
decision.setDecisionType(DecisionType.ContinueAsNewWorkflowExecution);
decision.setContinueAsNewWorkflowExecutionDecisionAttributes(attributes);
DecisionId decisionId = new DecisionId(DecisionTarget.SELF, null);
addDecision(decisionId, new CompleteWorkflowStateMachine(decisionId, decision));
}
Aggregations