Package com.github.workerframework.api
Interface TaskCallback
public interface TaskCallback
A callback interface used to announce the arrival of a new task for a worker to process or signal that the core should cancel its
tasks. Generally called from a WorkerQueue implementation.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Signal that any tasks queued or in operation should be aborted.void
registerNewTask
(TaskInformation taskInformation, byte[] taskData, Map<String, Object> headers) Announce to the worker core that a new task has been picked off the queue for processing.
-
Method Details
-
registerNewTask
void registerNewTask(TaskInformation taskInformation, byte[] taskData, Map<String, Object> headers) throws TaskRejectedException, InvalidTaskExceptionAnnounce to the worker core that a new task has been picked off the queue for processing.- Parameters:
taskInformation
- contains an arbitrary task referencetaskData
- the task data that is specific to the workers hostedheaders
- the map of key/value paired headers on the message- Throws:
TaskRejectedException
- if the worker framework rejected execution of the task at this timeInvalidTaskException
- if the worker framework indicates this task is invalid and cannot possibly be executed
-
abortTasks
void abortTasks()Signal that any tasks queued or in operation should be aborted. This usually means there was a problem with the queue and any accepted messages should be considered void.
-