Search in sources :

Example 1 with DecisionTaskScheduledEventAttributes

use of com.uber.cadence.DecisionTaskScheduledEventAttributes in project cadence-client by uber-java.

the class StateMachines method scheduleDecisionTask.

private static void scheduleDecisionTask(RequestContext ctx, DecisionTaskData data, StartWorkflowExecutionRequest request, long notUsed) {
    DecisionTaskScheduledEventAttributes a = new DecisionTaskScheduledEventAttributes().setStartToCloseTimeoutSeconds(request.getTaskStartToCloseTimeoutSeconds()).setTaskList(request.getTaskList()).setAttempt(data.attempt);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.DecisionTaskScheduled).setDecisionTaskScheduledEventAttributes(a);
    long scheduledEventId = ctx.addEvent(event);
    PollForDecisionTaskResponse decisionTaskResponse = new PollForDecisionTaskResponse();
    if (data.previousStartedEventId > 0) {
        decisionTaskResponse.setPreviousStartedEventId(data.previousStartedEventId);
    }
    decisionTaskResponse.setWorkflowExecution(ctx.getExecution());
    decisionTaskResponse.setWorkflowType(request.getWorkflowType());
    decisionTaskResponse.setAttempt(data.attempt);
    TaskListId taskListId = new TaskListId(ctx.getDomain(), request.getTaskList().getName());
    DecisionTask decisionTask = new DecisionTask(taskListId, decisionTaskResponse);
    ctx.setDecisionTask(decisionTask);
    ctx.onCommit((historySize) -> {
        data.scheduledEventId = scheduledEventId;
        data.decisionTask = decisionTaskResponse;
    });
}
Also used : DecisionTask(com.uber.cadence.internal.testservice.TestWorkflowStore.DecisionTask) TaskListId(com.uber.cadence.internal.testservice.TestWorkflowStore.TaskListId) PollForDecisionTaskResponse(com.uber.cadence.PollForDecisionTaskResponse) DecisionTaskScheduledEventAttributes(com.uber.cadence.DecisionTaskScheduledEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Aggregations

DecisionTaskScheduledEventAttributes (com.uber.cadence.DecisionTaskScheduledEventAttributes)1 HistoryEvent (com.uber.cadence.HistoryEvent)1 PollForDecisionTaskResponse (com.uber.cadence.PollForDecisionTaskResponse)1 DecisionTask (com.uber.cadence.internal.testservice.TestWorkflowStore.DecisionTask)1 TaskListId (com.uber.cadence.internal.testservice.TestWorkflowStore.TaskListId)1