Interface ComputationContext

    • Method Detail

      • setTimer

        void setTimer​(String key,
                      long time)
        Register a timer callback for some point in the future
        Parameters:
        key - Name of the timer callback.
        time - The (ms since epoch) at which the callback should be fired
      • produceRecord

        default void produceRecord​(String streamName,
                                   String key,
                                   byte[] data)
        Emit a record downstream. Records are send effectively on checkpoint using askForCheckpoint().
        Parameters:
        streamName - The name of the stream on which the record should be emitted.
        key - The key associated with the record. Only relevant when routing method is `GROUP_BY`.
        data - The binary blob to send downstream.
      • produceRecord

        void produceRecord​(String streamName,
                           Record record)
      • setSourceLowWatermark

        void setSourceLowWatermark​(long watermark)
        Set the low watermark for a source computation.
      • askForCheckpoint

        void askForCheckpoint()
        Ask for checkpoint in order to send records, save input stream offset positions.
      • cancelAskForCheckpoint

        void cancelAskForCheckpoint()
        Finally cancel the request to checkpoint the positions.
      • askForTermination

        void askForTermination()
        Ask to terminate this computation.
        Since:
        10.1
      • getLastOffset

        LogOffset getLastOffset()
        Returns:
        the LogOffset of the last record read.
        Since:
        10.3
      • getPolicy

        ComputationPolicy getPolicy()
        Gets the policy used to run the computation.
        Since:
        10.3
      • isSpareComputation

        boolean isSpareComputation()
        Returns:
        true if the computation is a spare instance without any Stream partition assigned. A spare computation will not receive any record and its timer will not be executed.
        Since:
        11.1