public final class ForwardingDisabledProcessorContext extends java.lang.Object implements ProcessorContext
ProcessorContext
implementation that will throw on any forward call.Constructor and Description |
---|
ForwardingDisabledProcessorContext(ProcessorContext delegate) |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
appConfigs()
Returns all the application config properties as key/value pairs.
|
java.util.Map<java.lang.String,java.lang.Object> |
appConfigsWithPrefix(java.lang.String prefix)
Returns all the application config properties with the given key prefix, as key/value pairs
stripping the prefix.
|
java.lang.String |
applicationId()
Returns the application id
|
java.lang.String |
applicationInternalStream()
Returns the application internal stream name
|
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.
|
org.apache.kafka.common.header.Headers |
headers()
Returns the headers of the current input record; could be null if it is not available
|
org.apache.kafka.common.serialization.Serde<?> |
keySerde()
Returns the default key serde
|
StreamsMetrics |
metrics()
Returns Metrics instance
|
long |
offset()
Returns the offset of the current input record; could be -1 if it is not
available (for example, if this method is invoked from the punctuate call)
|
int |
partition()
Returns the partition id of the current input record; could be -1 if it is not
available (for example, if this method is invoked from the punctuate call)
|
void |
register(StateStore store,
StateRestoreCallback stateRestoreCallback)
Registers and possibly restores the specified storage engine.
|
Cancellable |
schedule(java.time.Duration interval,
PunctuationType type,
Punctuator callback)
Schedules a periodic operation for processors.
|
Cancellable |
schedule(long intervalMs,
PunctuationType type,
Punctuator callback)
Deprecated.
|
java.io.File |
stateDir()
Returns the state directory for the partition.
|
TaskId |
taskId()
Returns the task id
|
long |
timestamp()
Returns the current timestamp.
|
java.lang.String |
topic()
Returns the topic name of the current input record; could be null if it is not
available (for example, if this method is invoked from the punctuate call)
|
org.apache.kafka.common.serialization.Serde<?> |
valueSerde()
Returns the default value serde
|
public ForwardingDisabledProcessorContext(ProcessorContext delegate)
public java.lang.String applicationId()
ProcessorContext
applicationId
in interface ProcessorContext
public java.lang.String applicationInternalStream()
ProcessorContext
applicationInternalStream
in interface ProcessorContext
public TaskId taskId()
ProcessorContext
taskId
in interface ProcessorContext
public org.apache.kafka.common.serialization.Serde<?> keySerde()
ProcessorContext
keySerde
in interface ProcessorContext
public org.apache.kafka.common.serialization.Serde<?> valueSerde()
ProcessorContext
valueSerde
in interface ProcessorContext
public java.io.File stateDir()
ProcessorContext
stateDir
in interface ProcessorContext
public StreamsMetrics metrics()
ProcessorContext
metrics
in interface ProcessorContext
public void register(StateStore store, StateRestoreCallback stateRestoreCallback)
ProcessorContext
register
in interface ProcessorContext
store
- the storage enginestateRestoreCallback
- the restoration callback logic for log-backed state stores upon restartpublic StateStore getStateStore(java.lang.String name)
ProcessorContext
getStateStore
in interface ProcessorContext
name
- The store name@Deprecated public Cancellable schedule(long intervalMs, 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
intervalMs
- 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 <K,V> void forward(K key, V value)
ProcessorContext
forward
in interface ProcessorContext
key
- keyvalue
- valuepublic <K,V> void forward(K key, V value, To to)
ProcessorContext
forward
in interface ProcessorContext
key
- keyvalue
- valueto
- the options to use when forwardingpublic <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 void commit()
ProcessorContext
commit
in interface ProcessorContext
public java.lang.String topic()
ProcessorContext
topic
in interface ProcessorContext
public int partition()
ProcessorContext
partition
in interface ProcessorContext
public long offset()
ProcessorContext
offset
in interface ProcessorContext
public org.apache.kafka.common.header.Headers headers()
ProcessorContext
headers
in interface ProcessorContext
public long timestamp()
ProcessorContext
ConsumerRecord
by TimestampExtractor
.
If it is triggered while processing a record generated not from the source processor (for example,
if this method is invoked from the punctuate call), timestamp is defined as the current
task's stream time, which is defined as the smallest among all its input stream partition timestamps.timestamp
in interface ProcessorContext
public java.util.Map<java.lang.String,java.lang.Object> appConfigs()
ProcessorContext
StreamsConfig
object and associated to the ProcessorContext.
The type of the values is dependent on the type
of the property
(e.g. the value of DEFAULT_KEY_SERDE_CLASS_CONFIG
will be of type Class
, even if it was specified as a String to
StreamsConfig(Map)
).
appConfigs
in interface ProcessorContext
public java.util.Map<java.lang.String,java.lang.Object> appConfigsWithPrefix(java.lang.String prefix)
ProcessorContext
StreamsConfig
object and associated to the ProcessorContext.appConfigsWithPrefix
in interface ProcessorContext
prefix
- the properties prefix