public interface TaskContext
StreamTask
, particularly during
initialization in an InitableTask
.Modifier and Type | Method and Description |
---|---|
<K> void |
deleteTimer(K key)
Delete the keyed timer in this task.
|
MetricsRegistry |
getMetricsRegistry() |
SamzaContainerContext |
getSamzaContainerContext() |
java.lang.Object |
getStore(java.lang.String name) |
java.util.Set<SystemStreamPartition> |
getSystemStreamPartitions() |
Table |
getTable(java.lang.String tableId) |
TaskName |
getTaskName() |
default java.lang.Object |
getUserContext()
Gets the user-defined context.
|
<K> void |
registerTimer(K key,
long timestamp,
TimerCallback<K> callback)
Register a keyed timer with a callback of
TimerCallback in this task. |
void |
setStartingOffset(SystemStreamPartition ssp,
java.lang.String offset)
Set the starting offset for the given
SystemStreamPartition . |
default void |
setUserContext(java.lang.Object context)
Sets the user-defined context.
|
MetricsRegistry getMetricsRegistry()
java.util.Set<SystemStreamPartition> getSystemStreamPartitions()
java.lang.Object getStore(java.lang.String name)
Table getTable(java.lang.String tableId)
TaskName getTaskName()
SamzaContainerContext getSamzaContainerContext()
void setStartingOffset(SystemStreamPartition ssp, java.lang.String offset)
SystemStreamPartition
. Offsets
can only be set for a SystemStreamPartition
assigned to this task
(as returned by getSystemStreamPartitions()
); 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.ssp
- SystemStreamPartition
whose offset should be setoffset
- to set for the given SystemStreamPartition
default void setUserContext(java.lang.Object context)
context
- the user-defined context to setdefault java.lang.Object getUserContext()
<K> void registerTimer(K key, long timestamp, TimerCallback<K> callback)
TimerCallback
in this task.
The callback will be invoked exclusively with any other operations for this task,
e.g. processing, windowing and commit.K
- type of the keykey
- timer keytimestamp
- epoch time when the timer will be fired, in millisecondscallback
- callback when the timer is fired<K> void deleteTimer(K key)
K
- type of the keykey
- timer key