Manage tasks - API

JLupinClientQueueUtil methods:

public Collection[] getClientWaitingTasks()

Array of tasks' collections accepted by client (JLupinClientQueueUtil) and sent to queue microservice for which results were not retrieved yet (applies to queues from which results are retreived).

Number of Collection structures is same as variable Integer innerWaitQueuesAmount from JLupinClientQueueUtil constructor.

public Long getClientWorkingTasksLength()

Number of tasks sent to queue microservice and currently beeing watched for retrieving results.

After executing method public void registerFunctionOnTaskResult(...) from JLupinClientQueueUtil class, task is saved in structure taskQueue.

JLupinClientQueueUtil periodically (constructor variable Integer waitTimeBetweenCheckingResultInMillis in case of PERIODICALLY algorithm or instantly in case of ON_INPUT_TASK algorithm) retrieves tasks form taskQueue structure (by deleting them) and thread which is currently executing task is incrementing counter workingQueueLength. After execution this variable is decremented and the task is put back to "taskQueue" list if it does not go to result retrieving state, for waiting time configured by constructor variable Long waitForTaskResultInMillis to await result. If in configured time result will not be returned by queue then exception will be thrown (called onError method passed as an argument for method public void registerFunctionOnTaskResult).

public JLupinQueueTaskState getQueueTaskState(String taskId) throws JLupinClientQueueUtilException

Returns state of specified task. Task in state TASK_FINISHED_WITH_RESULT_COMMIT(5) is ready to retrieve.

public <T> T getTaskResult(String taskId) throws JLupinClientQueueUtilException

Returns task result.

public void cancelTask(String taskId) throws JLupinClientQueueUtilException

Removes task from queue - after exectuing this method it is possible to schedule task again for execution.