public class ProcessorContextImpl extends AbstractProcessorContext implements RecordCollector.Supplier
currentNode, NONEXIST_TOPIC, recordContext
Modifier and Type | Method and Description |
---|---|
void |
commit()
Requests a commit
|
<K,V> void |
forward(K key,
V value)
Forwards a key/value pair to all downstream processors.
|
<K,V> void |
forward(K key,
V value,
int childIndex)
Forwards a key/value pair to one of the downstream processors designated by childIndex
|
<K,V> void |
forward(K key,
V value,
java.lang.String childName)
Forwards a key/value pair to one of the downstream processors designated by the downstream processor name
|
<K,V> void |
forward(K key,
V value,
To to)
Forwards a key/value pair to the specified downstream processors.
|
ProcessorStateManager |
getStateMgr() |
StateStore |
getStateStore(java.lang.String name)
Get the state store given the store name.
|
RecordCollector |
recordCollector()
Get the record collector.
|
Cancellable |
schedule(java.time.Duration interval,
PunctuationType type,
Punctuator callback)
Schedules a periodic operation for processors.
|
Cancellable |
schedule(long interval,
PunctuationType type,
Punctuator callback)
Deprecated.
|
long |
streamTime() |
appConfigs, appConfigsWithPrefix, applicationId, applicationInternalStream, currentNode, getCache, headers, initialize, keySerde, metrics, offset, partition, recordContext, register, setCurrentNode, setRecordContext, stateDir, taskId, timestamp, topic, uninitialize, valueSerde
public ProcessorStateManager getStateMgr()
public RecordCollector recordCollector()
RecordCollector.Supplier
recordCollector
in interface RecordCollector.Supplier
public StateStore getStateStore(java.lang.String name)
ProcessorContext
getStateStore
in interface ProcessorContext
name
- The store nameStreamsException
- if an attempt is made to access this state store from an unknown nodepublic <K,V> void forward(K key, V value)
ProcessorContext
forward
in interface ProcessorContext
key
- keyvalue
- valuepublic <K,V> void forward(K key, V value, int childIndex)
ProcessorContext
forward
in interface ProcessorContext
key
- keyvalue
- valuechildIndex
- index in list of children of this nodepublic <K,V> void forward(K key, V value, java.lang.String childName)
ProcessorContext
forward
in interface ProcessorContext
key
- keyvalue
- valuechildName
- name of downstream processorpublic <K,V> void forward(K key, V value, To to)
ProcessorContext
forward
in interface ProcessorContext
key
- keyvalue
- valueto
- the options to use when forwardingpublic void commit()
ProcessorContext
commit
in interface ProcessorContext
@Deprecated public Cancellable schedule(long interval, PunctuationType type, Punctuator callback)
ProcessorContext
initialization
or
processing
to
schedule a periodic callback — called a punctuation — to Punctuator.punctuate(long)
.
The type parameter controls what notion of time is used for punctuation:
PunctuationType.STREAM_TIME
— uses "stream time", which is advanced by the processing of messages
in accordance with the timestamp as extracted by the TimestampExtractor
in use.
The first punctuation will be triggered by the first record that is processed.
NOTE: Only advanced if messages arrivePunctuationType.WALL_CLOCK_TIME
— uses system time (the wall-clock time),
which is advanced independent of whether new messages arrive.
The first punctuation will be triggered after interval has elapsed.
NOTE: This is best effort only as its granularity is limited by how long an iteration of the
processing loop takes to completePunctuationType.STREAM_TIME
, when stream time advances more than intervalPunctuationType.WALL_CLOCK_TIME
, on GC pause, too short interval, ...schedule
in interface ProcessorContext
interval
- the time interval between punctuations in millisecondstype
- one of: PunctuationType.STREAM_TIME
, PunctuationType.WALL_CLOCK_TIME
callback
- a function consuming timestamps representing the current stream or system timepublic Cancellable schedule(java.time.Duration interval, PunctuationType type, Punctuator callback) throws java.lang.IllegalArgumentException
ProcessorContext
initialization
or
processing
to
schedule a periodic callback — called a punctuation — to Punctuator.punctuate(long)
.
The type parameter controls what notion of time is used for punctuation:
PunctuationType.STREAM_TIME
— uses "stream time", which is advanced by the processing of messages
in accordance with the timestamp as extracted by the TimestampExtractor
in use.
The first punctuation will be triggered by the first record that is processed.
NOTE: Only advanced if messages arrivePunctuationType.WALL_CLOCK_TIME
— uses system time (the wall-clock time),
which is advanced independent of whether new messages arrive.
The first punctuation will be triggered after interval has elapsed.
NOTE: This is best effort only as its granularity is limited by how long an iteration of the
processing loop takes to completePunctuationType.STREAM_TIME
, when stream time advances more than intervalPunctuationType.WALL_CLOCK_TIME
, on GC pause, too short interval, ...schedule
in interface ProcessorContext
interval
- the time interval between punctuationstype
- one of: PunctuationType.STREAM_TIME
, PunctuationType.WALL_CLOCK_TIME
callback
- a function consuming timestamps representing the current stream or system timejava.lang.IllegalArgumentException
public long streamTime()
streamTime
in interface InternalProcessorContext