Interface PipelineController

All Known Implementing Classes:
DefaultPipelineController

public interface PipelineController
The PipelineController is responsible for controlling the lifecycle of a Pipeline. The PipelineManager will call the methods of this interface to notify the PipelineController of various events that occur during the lifecycle of a pipeline, and the PipelineController will return the list of PipelineActions to perform in response to those events. The TaskController is generally free to decide how to respond to these events, for example implementing task-level retry logic or implementing a circuit-breaker pattern, but to ensure correctness, it must conform to the high-level task lifecycle defined by the PipelineManager.
  • Method Details

    • onPipelineStarted

      List<PipelineAction> onPipelineStarted()
      Called when the pipeline has been started. Called as the first event only.
      Returns:
      the next actions to perform
    • onTaskStarted

      List<PipelineAction> onTaskStarted(String id)
      Called when a task has been started. Called for each task as the first event.
      Parameters:
      id - the id of the task
      Returns:
      the next actions to perform
    • onTaskCompleted

      List<PipelineAction> onTaskCompleted(String id)
      Called when a task has been completed. No more events will be sent for this task.
      Parameters:
      id - the id of the task
      Returns:
      the next actions to perform
    • onTaskCancelled

      List<PipelineAction> onTaskCancelled(String id)
      Called when a task has been cancelled. No more events will be sent for this task.
      Parameters:
      id - the id of the task
      Returns:
      the next actions to perform
    • onTaskFailed

      List<PipelineAction> onTaskFailed(String id, Throwable error)
      Called when a task has failed. No more events will be sent for this task.
      Parameters:
      id - the id of the task
      error - the error that caused the task to fail
      Returns:
      the next actions to perform
    • onHeartbeat

      List<PipelineAction> onHeartbeat()
      Called when no lifecycle events have occurred within the heartbeat interval. This ensures that the controller has periodic access to execute actions even if no lifecycle events are occurring, for example to time out tasks or to perform maintenance tasks.
      Returns:
      the next action to perform
    • getHeartbeatInterval

      Duration getHeartbeatInterval()
      The maximum amount of time to wait for a lifecycle event, after which onHeartbeat() will be called.
    • onCancelRequested

      List<PipelineAction> onCancelRequested()
      Called when the pipeline has been requested to be cancelled. This is a request, not a command, and the pipeline may choose to ignore it.
      Returns:
      the next actions to perform
    • onPipelineCompleted

      void onPipelineCompleted()
      Called when the pipeline has been completed. This is the last event that will be called.
    • onPipelineFailed

      void onPipelineFailed(ExecutionException cause)
      Called when the pipeline has failed. This is the last event that will be called.
    • onPipelineCancelled

      void onPipelineCancelled()
      Called when the pipeline has been cancelled. This is the last event that will be called.