use of com.uber.cadence.ScheduleActivityTaskDecisionAttributes in project cadence-client by uber-java.
the class ActivityDecisionContext method scheduleActivityTask.
Consumer<Exception> scheduleActivityTask(ExecuteActivityParameters parameters, BiConsumer<byte[], Exception> callback) {
final OpenRequestInfo<byte[], ActivityType> context = new OpenRequestInfo<>(parameters.getActivityType());
final ScheduleActivityTaskDecisionAttributes attributes = new ScheduleActivityTaskDecisionAttributes();
attributes.setActivityType(parameters.getActivityType());
attributes.setInput(parameters.getInput());
if (parameters.getHeartbeatTimeoutSeconds() > 0) {
attributes.setHeartbeatTimeoutSeconds((int) parameters.getHeartbeatTimeoutSeconds());
}
attributes.setScheduleToCloseTimeoutSeconds((int) parameters.getScheduleToCloseTimeoutSeconds());
attributes.setScheduleToStartTimeoutSeconds((int) parameters.getScheduleToStartTimeoutSeconds());
attributes.setStartToCloseTimeoutSeconds((int) parameters.getStartToCloseTimeoutSeconds());
// attributes.setTaskPriority(InternalUtils.taskPriorityToString(parameters.getTaskPriority()));
String activityId = parameters.getActivityId();
if (activityId == null) {
activityId = String.valueOf(decisions.getNextId());
}
attributes.setActivityId(activityId);
String taskList = parameters.getTaskList();
if (taskList != null && !taskList.isEmpty()) {
TaskList tl = new TaskList();
tl.setName(taskList);
attributes.setTaskList(tl);
}
decisions.scheduleActivityTask(attributes);
context.setCompletionHandle(callback);
scheduledActivities.put(attributes.getActivityId(), context);
return new ActivityDecisionContext.ActivityCancellationHandler(attributes.getActivityId(), callback);
}
Aggregations