public class GlobalProcessorContextImpl extends AbstractProcessorContext
currentNode, NONEXIST_TOPIC, recordContext
Constructor and Description |
---|
GlobalProcessorContextImpl(StreamsConfig config,
org.apache.kafka.streams.processor.internals.StateManager stateMgr,
StreamsMetricsImpl metrics,
ThreadCache cache) |
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.
|
StateStore |
getStateStore(java.lang.String name)
Get the state store given the store name.
|
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 GlobalProcessorContextImpl(StreamsConfig config, org.apache.kafka.streams.processor.internals.StateManager stateMgr, StreamsMetricsImpl metrics, ThreadCache cache)
public StateStore getStateStore(java.lang.String name)
ProcessorContext
name
- The store namepublic <K,V> void forward(K key, V value)
ProcessorContext
key
- keyvalue
- valuepublic <K,V> void forward(K key, V value, To to)
ProcessorContext
key
- keyvalue
- valueto
- the options to use when forwardingjava.lang.UnsupportedOperationException
- on every invocationpublic <K,V> void forward(K key, V value, int childIndex)
ProcessorContext
key
- keyvalue
- valuechildIndex
- index in list of children of this nodejava.lang.UnsupportedOperationException
- on every invocationpublic <K,V> void forward(K key, V value, java.lang.String childName)
ProcessorContext
key
- keyvalue
- valuechildName
- name of downstream processorjava.lang.UnsupportedOperationException
- on every invocationpublic void commit()
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, ...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 timejava.lang.UnsupportedOperationException
- on every invocationpublic Cancellable schedule(java.time.Duration 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, ...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.UnsupportedOperationException
- on every invocationpublic long streamTime()