use of com.uber.cadence.PollForDecisionTaskResponse 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;
});
}
Aggregations