Class AbstractProcessorContext

    • Method Detail

      • applicationId

        public java.lang.String applicationId()
        Description copied from interface: ProcessorContext
        Returns the application id
        Specified by:
        applicationId in interface ProcessorContext
        Returns:
        the application id
      • applicationInternalStream

        public java.lang.String applicationInternalStream()
        Description copied from interface: ProcessorContext
        Returns the application internal stream name
        Specified by:
        applicationInternalStream in interface ProcessorContext
        Returns:
        the application internal stream
      • keySerde

        public org.apache.kafka.common.serialization.Serde<?> keySerde()
        Description copied from interface: ProcessorContext
        Returns the default key serde
        Specified by:
        keySerde in interface ProcessorContext
        Returns:
        the key serializer
      • valueSerde

        public org.apache.kafka.common.serialization.Serde<?> valueSerde()
        Description copied from interface: ProcessorContext
        Returns the default value serde
        Specified by:
        valueSerde in interface ProcessorContext
        Returns:
        the value serializer
      • stateDir

        public java.io.File stateDir()
        Description copied from interface: ProcessorContext
        Returns the state directory for the partition.
        Specified by:
        stateDir in interface ProcessorContext
        Returns:
        the state directory
      • register

        public void register​(StateStore store,
                             StateRestoreCallback stateRestoreCallback)
        Description copied from interface: ProcessorContext
        Registers and possibly restores the specified storage engine.
        Specified by:
        register in interface ProcessorContext
        Parameters:
        store - the storage engine
        stateRestoreCallback - the restoration callback logic for log-backed state stores upon restart
      • topic

        public java.lang.String topic()
        Description copied from interface: ProcessorContext
        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)
        Specified by:
        topic in interface ProcessorContext
        Returns:
        the topic name
        Throws:
        java.lang.IllegalStateException - if the task's record is null
      • partition

        public int partition()
        Description copied from interface: ProcessorContext
        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)
        Specified by:
        partition in interface ProcessorContext
        Returns:
        the partition id
        Throws:
        java.lang.IllegalStateException - if partition is null
      • offset

        public long offset()
        Description copied from interface: ProcessorContext
        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)
        Specified by:
        offset in interface ProcessorContext
        Returns:
        the offset
        Throws:
        java.lang.IllegalStateException - if offset is null
      • headers

        public org.apache.kafka.common.header.Headers headers()
        Description copied from interface: ProcessorContext
        Returns the headers of the current input record; could be null if it is not available
        Specified by:
        headers in interface ProcessorContext
        Returns:
        the headers
      • timestamp

        public long timestamp()
        Description copied from interface: ProcessorContext
        Returns the current timestamp. If it is triggered while processing a record streamed from the source processor, timestamp is defined as the timestamp of the current input record; the timestamp is extracted from 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.
        Specified by:
        timestamp in interface ProcessorContext
        Returns:
        the timestamp
        Throws:
        java.lang.IllegalStateException - if timestamp is null
      • appConfigs

        public java.util.Map<java.lang.String,​java.lang.Object> appConfigs()
        Description copied from interface: ProcessorContext
        Returns all the application config properties as key/value pairs. The config properties are defined in the 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)).

        Specified by:
        appConfigs in interface ProcessorContext
        Returns:
        all the key/values from the StreamsConfig properties
      • appConfigsWithPrefix

        public java.util.Map<java.lang.String,​java.lang.Object> appConfigsWithPrefix​(java.lang.String prefix)
        Description copied from interface: ProcessorContext
        Returns all the application config properties with the given key prefix, as key/value pairs stripping the prefix. The config properties are defined in the StreamsConfig object and associated to the ProcessorContext.
        Specified by:
        appConfigsWithPrefix in interface ProcessorContext
        Parameters:
        prefix - the properties prefix
        Returns:
        the key/values matching the given prefix from the StreamsConfig properties.