public interface TaskContext
Use ApplicationTaskContext for the application-defined context for the current task.
| Modifier and Type | Method and Description |
|---|---|
CallbackScheduler |
getCallbackScheduler()
Gets the
CallbackScheduler for this task, which can be used to schedule a callback to be executed
at a future time. |
KeyValueStore<?,?> |
getStore(java.lang.String storeName)
Gets the
KeyValueStore associated with storeName for this task. |
Table<?> |
getTable(java.lang.String tableId)
Gets the
Table corresponding to the tableId for this task. |
MetricsRegistry |
getTaskMetricsRegistry()
Gets the
MetricsRegistry for this task, which can be used to register metrics that are reported per task. |
TaskModel |
getTaskModel()
Gets the
TaskModel for this task, which contains this task's name and its SystemStreamPartitions. |
void |
setStartingOffset(SystemStreamPartition systemStreamPartition,
java.lang.String offset)
Sets the starting offset for the given
SystemStreamPartition. |
TaskModel getTaskModel()
TaskModel for this task, which contains this task's name and its SystemStreamPartitions.TaskModel for this taskMetricsRegistry getTaskMetricsRegistry()
MetricsRegistry for this task, which can be used to register metrics that are reported per task.MetricsRegistry for this taskKeyValueStore<?,?> getStore(java.lang.String storeName)
KeyValueStore associated with storeName for this task.
The returned store should be cast with the concrete type parameters based on the configured store serdes.
E.g., if using string key and integer value serde, it should be cast to a KeyValueStore<String, Integer>.
storeName - name of the KeyValueStore to get for this taskKeyValueStore associated with storeName for this taskjava.lang.IllegalArgumentException - if there is no store associated with storeNameTable<?> getTable(java.lang.String tableId)
Table corresponding to the tableId for this task.
The returned table should be cast with the concrete type parameters based on the configured table serdes, and
whether it is ReadWriteTable or ReadableTable. E.g., if using string key and integer value
serde for a writable table, it should be cast to a ReadWriteTable<String, Integer>.CallbackScheduler getCallbackScheduler()
CallbackScheduler for this task, which can be used to schedule a callback to be executed
at a future time.CallbackScheduler for this task@InterfaceStability.Evolving void setStartingOffset(SystemStreamPartition systemStreamPartition, java.lang.String offset)
SystemStreamPartition.
Offsets can only be set for a SystemStreamPartition assigned to this task.
The SystemStreamPartitions assigned to this task can be accessed through
TaskModel.getSystemStreamPartitions() for the TaskModel obtained by calling
getTaskModel(). Trying to set the offset for any other partition will have no effect.
NOTE: this feature is experimental, and the API may change in a future release.
systemStreamPartition - SystemStreamPartition whose offset should be setoffset - to set for the given SystemStreamPartition