Search in sources :

Example 1 with WorkflowExecutionStartedEventAttributes

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;
}
Also used : WorkflowExecutionStartedEventAttributes(com.uber.cadence.WorkflowExecutionStartedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Example 2 with WorkflowExecutionStartedEventAttributes

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);
}
Also used : ChildWorkflowExecutionStartedEventAttributes(com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes) WorkflowExecutionStartedEventAttributes(com.uber.cadence.WorkflowExecutionStartedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Example 3 with WorkflowExecutionStartedEventAttributes

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));
}
Also used : ContinueAsNewWorkflowExecutionDecisionAttributes(com.uber.cadence.ContinueAsNewWorkflowExecutionDecisionAttributes) TaskList(com.uber.cadence.TaskList) ChildWorkflowExecutionStartedEventAttributes(com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes) WorkflowExecutionStartedEventAttributes(com.uber.cadence.WorkflowExecutionStartedEventAttributes) Decision(com.uber.cadence.Decision)

Aggregations

WorkflowExecutionStartedEventAttributes (com.uber.cadence.WorkflowExecutionStartedEventAttributes)3 ChildWorkflowExecutionStartedEventAttributes (com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes)2 HistoryEvent (com.uber.cadence.HistoryEvent)2 ContinueAsNewWorkflowExecutionDecisionAttributes (com.uber.cadence.ContinueAsNewWorkflowExecutionDecisionAttributes)1 Decision (com.uber.cadence.Decision)1 TaskList (com.uber.cadence.TaskList)1