Class GlobalProcessorContextImpl
- java.lang.Object
-
- org.apache.kafka.streams.processor.internals.AbstractProcessorContext
-
- org.apache.kafka.streams.processor.internals.GlobalProcessorContextImpl
-
- All Implemented Interfaces:
InternalProcessorContext,ProcessorContext
public class GlobalProcessorContextImpl extends AbstractProcessorContext
-
-
Field Summary
-
Fields inherited from class org.apache.kafka.streams.processor.internals.AbstractProcessorContext
cache, currentNode, NONEXIST_TOPIC, recordContext
-
Fields inherited from interface org.apache.kafka.streams.processor.internals.InternalProcessorContext
BYTEARRAY_VALUE_SERIALIZER, BYTES_KEY_SERIALIZER
-
-
Constructor Summary
Constructors Constructor Description GlobalProcessorContextImpl(StreamsConfig config, org.apache.kafka.streams.processor.internals.StateManager stateMgr, StreamsMetricsImpl metrics, ThreadCache cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcommit()Requests a commit.<K,V>
voidforward(K key, V value)Forwards a key/value pair to all downstream processors.<K,V>
voidforward(K key, V value, int childIndex)Deprecated.<K,V>
voidforward(K key, V value, java.lang.String childName)Deprecated.<K,V>
voidforward(K key, V value, To to)No-op.StateStoregetStateStore(java.lang.String name)Get the state store given the store name.voidlogChange(java.lang.String storeName, org.apache.kafka.common.utils.Bytes key, byte[] value, long timestamp)voidregisterCacheFlushListener(java.lang.String namespace, ThreadCache.DirtyEntryFlushListener listener)Register a dirty entry flush listener for a particular namespaceCancellableschedule(long interval, PunctuationType type, Punctuator callback)Deprecated.Cancellableschedule(java.time.Duration interval, PunctuationType type, Punctuator callback)Schedules a periodic operation for processors.voidtransitionToActive(StreamTask streamTask, RecordCollector recordCollector, ThreadCache newCache)Transition to active task and register a new task and cache to this processor contextvoidtransitionToStandby(ThreadCache newCache)Transition to standby task and register a dummy cache to this processor context-
Methods inherited from class org.apache.kafka.streams.processor.internals.AbstractProcessorContext
appConfigs, appConfigsWithPrefix, applicationId, applicationInternalStream, cache, currentNode, currentSystemTimeMs, headers, initialize, keySerde, metrics, offset, partition, recordContext, register, setCurrentNode, setRecordContext, setSystemTimeMs, stateDir, taskId, taskType, timestamp, topic, uninitialize, valueSerde
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.kafka.streams.processor.internals.InternalProcessorContext
getStateStore
-
-
-
-
Constructor Detail
-
GlobalProcessorContextImpl
public GlobalProcessorContextImpl(StreamsConfig config, org.apache.kafka.streams.processor.internals.StateManager stateMgr, StreamsMetricsImpl metrics, ThreadCache cache)
-
-
Method Detail
-
getStateStore
public StateStore getStateStore(java.lang.String name)
Description copied from interface:ProcessorContextGet the state store given the store name.- Parameters:
name- The store name- Returns:
- The state store instance
-
forward
public <K,V> void forward(K key, V value)Description copied from interface:ProcessorContextForwards a key/value pair to all downstream processors. Used the input record's timestamp as timestamp for the output record.- Parameters:
key- keyvalue- value
-
forward
public <K,V> void forward(K key, V value, To to)No-op. This should only be called on GlobalStateStore#flush and there should be no child nodes- Parameters:
key- keyvalue- valueto- the options to use when forwarding
-
forward
@Deprecated public <K,V> void forward(K key, V value, int childIndex)Deprecated.Description copied from interface:ProcessorContextForwards a key/value pair to one of the downstream processors designated by childIndex.- Parameters:
key- keyvalue- valuechildIndex- index in list of children of this node- Throws:
java.lang.UnsupportedOperationException- on every invocation
-
forward
@Deprecated public <K,V> void forward(K key, V value, java.lang.String childName)Deprecated.Description copied from interface:ProcessorContextForwards a key/value pair to one of the downstream processors designated by the downstream processor name.- Parameters:
key- keyvalue- valuechildName- name of downstream processor- Throws:
java.lang.UnsupportedOperationException- on every invocation
-
commit
public void commit()
Description copied from interface:ProcessorContextRequests a commit.
-
schedule
@Deprecated public Cancellable schedule(long interval, PunctuationType type, Punctuator callback)
Deprecated.Description copied from interface:ProcessorContextSchedules a periodic operation for processors. A processor may call this method duringinitializationorprocessingto schedule a periodic callback — called a punctuation — toPunctuator.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 theTimestampExtractorin 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 complete
- with
PunctuationType.STREAM_TIME, when stream time advances more than interval - with
PunctuationType.WALL_CLOCK_TIME, on GC pause, too short interval, ...
- Parameters:
interval- the time interval between punctuations in millisecondstype- one of:PunctuationType.STREAM_TIME,PunctuationType.WALL_CLOCK_TIMEcallback- a function consuming timestamps representing the current stream or system time- Returns:
- a handle allowing cancellation of the punctuation schedule established by this method
- Throws:
java.lang.UnsupportedOperationException- on every invocation
-
schedule
public Cancellable schedule(java.time.Duration interval, PunctuationType type, Punctuator callback)
Description copied from interface:ProcessorContextSchedules a periodic operation for processors. A processor may call this method duringinitializationorprocessingto schedule a periodic callback — called a punctuation — toPunctuator.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 theTimestampExtractorin 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 complete
- with
PunctuationType.STREAM_TIME, when stream time advances more than interval - with
PunctuationType.WALL_CLOCK_TIME, on GC pause, too short interval, ...
- Parameters:
interval- the time interval between punctuations (supported minimum is 1 millisecond)type- one of:PunctuationType.STREAM_TIME,PunctuationType.WALL_CLOCK_TIMEcallback- a function consuming timestamps representing the current stream or system time- Returns:
- a handle allowing cancellation of the punctuation schedule established by this method
- Throws:
java.lang.UnsupportedOperationException- on every invocation
-
logChange
public void logChange(java.lang.String storeName, org.apache.kafka.common.utils.Bytes key, byte[] value, long timestamp)
-
transitionToActive
public void transitionToActive(StreamTask streamTask, RecordCollector recordCollector, ThreadCache newCache)
Description copied from interface:InternalProcessorContextTransition to active task and register a new task and cache to this processor context
-
transitionToStandby
public void transitionToStandby(ThreadCache newCache)
Description copied from interface:InternalProcessorContextTransition to standby task and register a dummy cache to this processor context
-
registerCacheFlushListener
public void registerCacheFlushListener(java.lang.String namespace, ThreadCache.DirtyEntryFlushListener listener)Description copied from interface:InternalProcessorContextRegister a dirty entry flush listener for a particular namespace
-
-