Class OffsetCommitter<ID>


  • public class OffsetCommitter<ID>
    extends java.lang.Object
    A committer of kafka offsets. This committer is used for asynchronous operations to enforce that the offset is not committed earlier then all associated actions are performed.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  OffsetCommitter.Callback
      Callback to be called for performing the commit.
    • Constructor Summary

      Constructors 
      Constructor Description
      OffsetCommitter()  
      OffsetCommitter​(long staleCommitWarningMillis, long autoCommitMs)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clear completely all mappings.
      void clear​(ID id, long offset)
      Clear all records for given topic partition and offset.
      void confirm​(ID id, long offset)
      Confirm that action associated with given offset has been performed.
      void register​(ID id, long offset, int numActions, OffsetCommitter.Callback commit)
      Register number of actions to be performed before offset can be committed.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • OffsetCommitter

        public OffsetCommitter()
      • OffsetCommitter

        public OffsetCommitter​(long staleCommitWarningMillis,
                               long autoCommitMs)
    • Method Detail

      • register

        public void register​(ID id,
                             long offset,
                             int numActions,
                             OffsetCommitter.Callback commit)
        Register number of actions to be performed before offset can be committed.
        Parameters:
        id - id of the consumer
        offset - the registered offset
        numActions - how many times confirm(Object, long) should be called to consider the action as done
        commit - OffsetCommitter.Callback to call to commit
      • confirm

        public void confirm​(ID id,
                            long offset)
        Confirm that action associated with given offset has been performed.
        Parameters:
        id - id of the consumer
        offset - the offset to confirm
      • clear

        public void clear​(ID id,
                          long offset)
        Clear all records for given topic partition and offset.
        Parameters:
        id - id of the consumer
        offset - offset to clear
      • clear

        public void clear()
        Clear completely all mappings.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object