Class ContextImpl

  • All Implemented Interfaces:
    Context

    public class ContextImpl
    extends Object
    implements Context
    Context is the information available at runtime for operators like transform. It contains basic things like config, runtime information like task, the stream that it is operating on, ProcessState, etc.
    • Method Detail

      • getTaskId

        public int getTaskId()
        Description copied from interface: Context
        Fetches the task id of the current instance of the operator
        Specified by:
        getTaskId in interface Context
        Returns:
        the task id.
      • getConfig

        public Map<String,​Object> getConfig()
        Description copied from interface: Context
        Fetches the config of the computation
        Specified by:
        getConfig in interface Context
        Returns:
        config
      • getStreamName

        public String getStreamName()
        Description copied from interface: Context
        The stream name that we are operating on
        Specified by:
        getStreamName in interface Context
        Returns:
        the stream name that we are operating on
      • getStreamPartition

        public int getStreamPartition()
        Description copied from interface: Context
        The partition number that we are operating on
        Specified by:
        getStreamPartition in interface Context
        Returns:
        the partition number
      • registerMetric

        public <T> void registerMetric​(String metricName,
                                       int collectionInterval,
                                       Supplier<T> metricFn)
        Description copied from interface: Context
        Register a metric function. This function will be called by the system every collectionInterval seconds and the resulting value will be collected
        Specified by:
        registerMetric in interface Context
      • getState

        public State<Serializable,​Serializable> getState()
        Description copied from interface: Context
        The state where components can store any of their local state
        Specified by:
        getState in interface Context
        Returns:
        The state interface where users can store their local state