public interface TaskCoordinator
StreamTaskimplementations to allow the user code to request actions from the Samza framework, including committing the current checkpoints to configured org.apache.samza.checkpoint.CheckpointManager or shutting down the task or all tasks within a container.
This interface may evolve over time.
|Modifier and Type||Interface and Description|
|Modifier and Type||Method and Description|
Requests that Samza should write out a checkpoint, from which a task can restart after failure.
Requests that the container should be shut down.
void commit(TaskCoordinator.RequestScope scope)
CURRENT_TASK is given, a checkpoint is only written for the
current task. If
ALL_TASKS_IN_CONTAINER is given, a checkpoint is
written for all tasks in the current container.
Note that if you also have also configured your job to commit in regular
intervals (using the
task.commit.ms property), those time-based
commits are not affected by calling this method. Any commits you request explicitly
are in addition to timer-based commits. You can set
if you don't want commits to happen automatically.
scope- Which tasks are being asked to commit.
void shutdown(TaskCoordinator.RequestScope scope)
CURRENT_TASK is given, that indicates a willingness of the current
task to shut down. All tasks in the container (including the one that requested
shutdown) will continue processing messages. Only when every task in the container
shutdown(CURRENT_TASK), the container is shut down. Once a
task has called
shutdown(CURRENT_TASK), it cannot change its mind
(i.e. it cannot revoke its willingness to shut down).
ALL_TASKS_IN_CONTAINER is given, the container will shut down
immediately after it has finished processing the current message. Any buffers of
pending writes are flushed, but no further messages will be processed in this
scope- The approach we should use for shutting down the container.