Search in sources :

Example 1 with TaskQueuesLogic

use of teammates.logic.core.TaskQueuesLogic in project teammates by TEAMMATES.

the class TaskQueuer method addDeferredTask.

protected void addDeferredTask(String queueName, String workerUrl, Map<String, String> paramMap, long countdownTime) {
    Map<String, String[]> multisetParamMap = new HashMap<>();
    paramMap.forEach((key, value) -> multisetParamMap.put(key, new String[] { value }));
    TaskWrapper task = new TaskWrapper(queueName, workerUrl, multisetParamMap);
    new TaskQueuesLogic().addDeferredTask(task, countdownTime);
}
Also used : TaskWrapper(teammates.common.util.TaskWrapper) HashMap(java.util.HashMap) TaskQueuesLogic(teammates.logic.core.TaskQueuesLogic)

Example 2 with TaskQueuesLogic

use of teammates.logic.core.TaskQueuesLogic in project teammates by TEAMMATES.

the class TaskQueuer method addTaskMultisetParam.

protected void addTaskMultisetParam(String queueName, String workerUrl, Map<String, String[]> paramMap) {
    TaskWrapper task = new TaskWrapper(queueName, workerUrl, paramMap);
    new TaskQueuesLogic().addTask(task);
}
Also used : TaskWrapper(teammates.common.util.TaskWrapper) TaskQueuesLogic(teammates.logic.core.TaskQueuesLogic)

Example 3 with TaskQueuesLogic

use of teammates.logic.core.TaskQueuesLogic in project teammates by TEAMMATES.

the class TaskQueuer method addTask.

// The following methods are facades to the actual logic for adding tasks to the queue.
// Using this method, the actual logic can still be black-boxed
// while at the same time allowing this API to be mocked during test.
protected void addTask(String queueName, String workerUrl, Map<String, String> paramMap) {
    Map<String, String[]> multisetParamMap = new HashMap<>();
    paramMap.forEach((key, value) -> multisetParamMap.put(key, new String[] { value }));
    TaskWrapper task = new TaskWrapper(queueName, workerUrl, multisetParamMap);
    new TaskQueuesLogic().addTask(task);
}
Also used : TaskWrapper(teammates.common.util.TaskWrapper) HashMap(java.util.HashMap) TaskQueuesLogic(teammates.logic.core.TaskQueuesLogic)

Aggregations

TaskWrapper (teammates.common.util.TaskWrapper)3 TaskQueuesLogic (teammates.logic.core.TaskQueuesLogic)3 HashMap (java.util.HashMap)2