Interface TaskRequestHandler<T extends TaskRequest>

  • Type Parameters:
    T - A TaskRequest implementation that can have extra fields and methods to be used by the TaskRequestHandler.

    public interface TaskRequestHandler<T extends TaskRequest>
    Classes implementing this interface will handle the actual TaskRequest.
    • Method Detail

      • run

        void run​(T taskRequest)
          throws Exception
        The actual task processing to perform.
        Parameters:
        taskRequest - the TaskRequest to be processed
        Throws:
        Exception - if an error occurs during the processing, Carrot will automatically retry the task.
      • taskContext

        default TaskContext taskContext()
        Gives access to the TaskContext for the current task in a thread-safe manner. It will be available only during the run(TaskRequest) method.
        Returns:
        the TaskContext for the current Task