Package titan.tasks
Interface TaskHandler
- All Known Implementing Classes:
FileHandler,PdfConversionHandler,ScriptExecutorHandler,ServiceHandler
public interface TaskHandler
TaskHandler defines a contract for components that can execute a specific task.
Implementations of this interface are responsible for processing an input payload
and returning a result, typically as a String.
This interface also provides a default mechanism for setting a log listener, allowing for external observation of task execution logs.
-
Method Summary
-
Method Details
-
execute
Executes a task with the given payload. Implementations should define the specific logic for processing the payload and generating a result.- Parameters:
payload- The input data or parameters for the task, typically in a serialized format like JSON or XML.- Returns:
- A string representing the result of the task execution. This could be a success message, a serialized object, or an error message.
-
setLogListener
Sets a listener to receive log messages generated during the task execution. This default implementation does nothing, but concrete implementations can override it to provide logging capabilities, for example, to send logs to a centralized logging system or to a UI component.- Parameters:
listener- AConsumerthat accepts log messages as strings. Ifnull, any previously set listener should be removed or ignored.
-