Class StreamTask

    • Method Detail

      • isActive

        public boolean isActive()
        Specified by:
        isActive in interface Task
      • suspend

        public void suspend()
        Specified by:
        suspend in interface Task
      • resume

        public void resume()
         - resume the task
         
        Specified by:
        resume in interface Task
      • postCommit

        public void postCommit()
        This should only be called if the attempted commit succeeded for this task
        Specified by:
        postCommit in interface Task
      • closeClean

        public void closeClean()
        Description copied from interface: Task
        Must be idempotent.
        Specified by:
        closeClean in interface Task
      • closeDirty

        public void closeDirty()
        Description copied from interface: Task
        Must be idempotent.
        Specified by:
        closeDirty in interface Task
      • closeCleanAndRecycleState

        public void closeCleanAndRecycleState()
        Description copied from interface: Task
        Attempt a clean close but do not close the underlying state
        Specified by:
        closeCleanAndRecycleState in interface Task
      • isProcessable

        public boolean isProcessable​(long wallClockTime)
        An active task is processable if its buffer contains data for all of its input source topic partitions, or if it is enforced to be processable
      • process

        public boolean process​(long wallClockTime)
        Process one record.
        Specified by:
        process in interface Task
        Returns:
        true if this method processes a record, false if it does not process a record.
        Throws:
        TaskMigratedException - if the task producer got fenced (EOS only)
      • recordProcessBatchTime

        public void recordProcessBatchTime​(long processBatchTime)
        Specified by:
        recordProcessBatchTime in interface Task
      • recordProcessTimeRatioAndBufferSize

        public void recordProcessTimeRatioAndBufferSize​(long allTaskProcessMs,
                                                        long now)
        Specified by:
        recordProcessTimeRatioAndBufferSize in interface Task
      • addRecords

        public void addRecords​(TopicPartition partition,
                               Iterable<ConsumerRecord<byte[],​byte[]>> records)
        Adds records to queues. If a record has an invalid (i.e., negative) timestamp, the record is skipped and not added to the queue for processing
        Specified by:
        addRecords in interface Task
        Parameters:
        partition - the partition
        records - the records
      • schedule

        public Cancellable schedule​(long interval,
                                    PunctuationType type,
                                    Punctuator punctuator)
        Schedules a punctuation for the processor
        Parameters:
        interval - the interval in milliseconds
        type - the punctuation type
        Throws:
        IllegalStateException - if the current node is not null
      • maybePunctuateStreamTime

        public boolean maybePunctuateStreamTime()
        Possibly trigger registered stream-time punctuation functions if current partition group timestamp has reached the defined stamp Note, this is only called in the presence of new records
        Specified by:
        maybePunctuateStreamTime in interface Task
        Throws:
        TaskMigratedException - if the task producer got fenced (EOS only)
      • maybePunctuateSystemTime

        public boolean maybePunctuateSystemTime()
        Possibly trigger registered system-time punctuation functions if current system timestamp has reached the defined stamp Note, this is called irrespective of the presence of new records
        Specified by:
        maybePunctuateSystemTime in interface Task
        Throws:
        TaskMigratedException - if the task producer got fenced (EOS only)
      • commitRequested

        public boolean commitRequested()
        Whether or not a request has been made to commit the current state
        Specified by:
        commitRequested in interface Task
      • toString

        public String toString()
        Produces a string representation containing useful information about a Task. This is useful in debugging scenarios.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the StreamTask instance.
      • toString

        public String toString​(String indent)
        Produces a string representation containing useful information about a Task starting with the given indent. This is useful in debugging scenarios.
        Returns:
        A string representation of the Task instance.
      • commitNeeded

        public boolean commitNeeded()
        Specified by:
        commitNeeded in interface Task
      • changelogOffsets

        public Map<TopicPartition,​Long> changelogOffsets()
        Specified by:
        changelogOffsets in interface Task
        Returns:
        the offsets of all the changelog partitions associated with this task, indicating the current positions of the logged state stores of the task.
      • hasRecordsQueued

        public boolean hasRecordsQueued()