Interface OffsetCommitPolicy

All Known Implementing Classes:
OffsetCommitPolicy.AlwaysCommitOffsetPolicy, OffsetCommitPolicy.PeriodicCommitOffsetPolicy
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Incubating @FunctionalInterface public interface OffsetCommitPolicy
The policy that defines when the offsets should be committed to offset storage.
Author:
Randall Hauch
  • Method Details

    • always

      static OffsetCommitPolicy always()
    • periodic

      static OffsetCommitPolicy periodic(Properties config)
    • performCommit

      boolean performCommit(long numberOfMessagesSinceLastCommit, Duration timeSinceLastCommit)
      Determine if a commit of the offsets should be performed.
      Parameters:
      numberOfMessagesSinceLastCommit - the number of messages that have been received from the connector since last the offsets were last committed; never negative
      timeSinceLastCommit - the time that has elapsed since the offsets were last committed; never negative
      Returns:
      true if the offsets should be committed, or false otherwise
    • or

      Obtain a new OffsetCommitPolicy that will commit offsets if this policy OR the other requests it.
      Parameters:
      other - the other commit policy; if null, then this policy instance is returned as is
      Returns:
      the resulting policy; never null
    • and

      Obtain a new OffsetCommitPolicy that will commit offsets if both this policy AND the other requests it.
      Parameters:
      other - the other commit policy; if null, then this policy instance is returned as is
      Returns:
      the resulting policy; never null